
- Forum
- Programming Talk
- PHP
- send mail in Php?
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 ...
-
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?
-
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...
-
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

Reply With Quote





