Results 1 to 4 of 4

Thread: seding email thruogh php

  1. #1
    Join Date
    Aug 2009
    Posts
    74
    Thanks
    7
    Thanked 1 Time in 1 Post

    Question seding email thruogh php

    iam getting this warning when iam submiting my form


    Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\wamp\www\project\post3.php on line 40

    Message delivery failed...



    and my code is

    $to = "hema@gmail.com";
    $subject = "Hi!";
    $body = "Hi,\n\nHow are you?";
    if (mail($to, $subject, $body)) {
    echo("<p>Message successfully sent!</p>");
    } else {
    echo("<p>Message delivery failed...</p>");

    exit();
    }


    acually i got this code from google,if ur having the better one please help me

  2. #2
    Join Date
    Apr 2009
    Location
    Cognac, France
    Posts
    400
    Thanks
    2
    Thanked 57 Times in 57 Posts

    Default

    As a simple starter mailer that is ok, I tend to add another variable like so,
    PHP Code:
    $headers 'From: webmaster@example.com' "\r\n" .
        
    'Reply-To: webmaster@example.com' "\r\n" ;

    mail($to$subject$body$headers); 
    However, your problem seems more to do with PHP not being able to open the port assigned to SMTP.

    Have a look at this link, http://www.php.net/manual/en/ref.mail.php

  3. #3
    Join Date
    Mar 2007
    Location
    New York, NY
    Posts
    557
    Thanks
    8
    Thanked 66 Times in 66 Posts

    Default

    Seeing as you're probably new to the mail function, I advise you to contact your webhost. If you're running it on your own server, SMTP may not be properly configured, or not work at all.
    - Josh

  4. #4
    Join Date
    Aug 2009
    Posts
    74
    Thanks
    7
    Thanked 1 Time in 1 Post

    Default

    thank u

Bookmarks

Posting Permissions

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