www.webdeveloper.com
Results 1 to 3 of 3

Thread: Getting mail() to send my emails

Hybrid View

  1. #1
    Join Date
    Jul 2009
    Posts
    32

    Exclamation Getting mail() to send my emails

    Hey Gents,

    Here is my Issue, i'm getting an error trying to get my form to submit and send emails. The development site is at www.marinetechegypt.com/contact.php

    I tried it locally on my WAMP first, it wasn't sending so i decided to test on the server incase its a local config issue.

    I just get an error from the If condition for if(isset($_POST['submit'])) {]. Im really trying my best to solve this but i'm not sure what i'm missing! any help would be greatly appreciated, thx

    The HTML:
    HTML Code:
        <div class="col one-half">
                <h3> Send us an Email </h3>
                    <div class="ajax_message"></div>
                    <form class="contact-form" method="post" action="php-mailer.php">
                        <input type="hidden" name="ac" value="login" />
                        <p>
                            <label for="fname"> Your Name <span class="required"> * </span> </label>
                            <input type="text" name="fname" class="input-short" id="fname" placeholder="Your Full Name" />
                            <?php if(isset($errName1)) echo $errName1; ?>
                        </p>
                        <p>
                            <label for="email"> Your Email <span class="required"> * </span> </label>
                            <input type="text" name="email" class="input-long" id="email" placeholder="Your Email" />
                            <?php if(isset($errEmail)) echo $errEmail; ?>
                        </p>
                        <p>
                            <label> Subject </label>
                            <input name="subject" type="text"  id="subject" class="input-short" placeholder="Subject"/>
                        </p>
                        <p>
                            <label for="message"> Your Message <span class="required"> * </span> </label>
                            <textarea name="message" class="textarea-message" id="textarea" placeholder="Your Message"></textarea>
                            <?php if(isset($errMessage)) echo $errMessage; ?>
                        </p>
                        <p><input name="submit" type="submit" value="Send Message" class="button small grey contact-submit" /></p> 
                </form>
                <div class="error-container" style="display:none;"> Please fill the above required fields correctly! </div>
            </div>
    phpmailer file: are there missing dependencies for this php function or what? Ive changed the adressed to hide the emails and such

    Code:
    <?php 
        if(isset($_POST['submit'])) {
               $to = "SendTo@email.com";
               $subject = "Marinetech Egypt Contact Form";
               $first_name_field = $_POST['fname'];
               $email_field = $_POST['email'];
               $message = $_POST['textarea'];
               $message = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
        <html xmlns="http://www.w3.org/1999/xhtml">
        <head></head>
        <body>
        <table>
            <tr><td>Name</td><td>' . $first_name_field . '</td></tr>
            <tr><td>Email</td><td>' .  $email_field . '</td></tr>
            <tr><td>Website</td><td>' . $subject . '</td></tr>
            <tr><td>Comment</td><td>' . nl2br($message) . '</td></tr>
        </table>
        </body>
        </html>';
    
                $headers = 'MIME-Version: 1.0' . "\r\n";
                $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
    
                // Additional headers
              $headers .= 'To: <SendTo@email.com>' . "\r\n";
              $headers .= '[From] <SendFrom@email.com>' . "\r\n";
    
        // Mail it
        
        ini_set('SMTP','mbox.freehostia.com');
        ini_set('smtp_port','25');
       // ini_set('username' , 'SendFrom@email.com');
     //   ini_set('password' , 'XXXXXXXX');
    //    ini_set('sendmail_from','SendFrom@email.com');
        
        mail($to, $subject, $message, $headers);
        include('index.html');   
                 } else {
                         echo "Error";
                  }
        ?>

  2. #2
    Join Date
    Jul 2009
    Posts
    32
    Hello heloo hello.. i can here my echo in here

    Can som1 atleast pont me in the direction for a working php mailer script. preferably with some validation also ?

    Ive tried so many edits to make it work, by adding ini settings for the smtp authentication ..etc still no lock just get a error and the emails aren't delivered.

  3. #3
    Join Date
    Mar 2009
    Posts
    452
    what error message do you get ?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles