Exforsys
+ Reply to Thread
Results 1 to 3 of 3

send mail in Php?

This is a discussion on send mail in Php? within the PHP forums, part of the Programming Talk category; i want to send an automatic mail in a php script.i can use mail() fuction but it is not working.how ...

  1. #1
    Prabhu N is offline Junior Member Array
    Join Date
    Feb 2006
    Answers
    14

    send mail in Php?

    i want to send an automatic mail in a php script.i can use mail() fuction but it is not working.how to resolve this problem?


  2. #2
    lokeshm is offline Member Array
    Join Date
    Apr 2005
    Answers
    83
    Correct syntax for mail function is
    @mail('<<email-id>>','<<subject>>',<<message>>,<<header>>);

    It should work, Why it is not working
    What error message are you getting
    Post the error message here let us see...


  3. #3
    ashlee is offline Senior Member Array
    Join Date
    Apr 2006
    Answers
    108
    As you said you ahve used mail() function and you are not getting kindly place the error you got and how you used mail() function so that I could help you out in this.

    One way of using the mail() function is as follows:

    PHP Code:
    $send_to = "exa@xxx.com";
    $subject = "Example";
    $message = 'Example Message';
    $headers = "From: sas@test.com";
    $headers .= "\r\n" . 'X-Mailer: PHP/' . phpversion();
    mail($send_to, $subject, $message, $headers);

    This code adds two headers. You could add others or comment out the second one. If multiple headers are present they need to be separated by a carriage return/line feed.

    You can also set the default From: in your php.ini.


    •    Sponsored Ads



Latest Article

Network Security Risk Assessment and Measurement

Read More...