I have a truoble in sending emails
Hello
I use this code to send emails from my website using PHP:
PHP Code:
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=windows-1256\r\n";
$headers .= "From: Express English <[email protected]>";
$message = '
<html><body>'
. 'Hello' .
'</body></html>';
mail (to,subject,$message,$headers);
It was working for a while as well, but today it wasn't working any more.
No emails have been sent.
What's problem?
Please
Re: I have a truoble in sending emails
if it was working before and isn't now, it's probably something to do with your host. if you have a free host, they might have turned off your ability to send email because you're sending too many, or something like that. if you don't have a free host, then you should talk to their tech support about it.
Re: I have a truoble in sending emails
Also you have not specified the email address(es) to be sent to or the subject.
This line
PHP Code:
mail (to,subject,$message,$headers);
should be
PHP Code:
mail ($to,$subject,$message,$headers);
Re: I have a truoble in sending emails
My website isn't free and I know it's "$to" not "to".
But If I removed $headers value, it works well.
why?
Re: I have a truoble in sending emails
This is how I send emails in PHP which works fine each time.
PHP Code:
$headers .= "From: [email protected]\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1";
mail ("$to", "My Subject", "$message", "$headers");
Re: I have a truoble in sending emails
It isn't working if I used $headers value.
Re: I have a truoble in sending emails
Now, I've just tried to remove the line:
PHP Code:
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
So now I use the code:[
PHP Code:
$headers .= "From: Express English <[email protected]>";
$msg = "
Thank you for registering at My Website Name.
The purpose of this confirmation message is to verify that the email address you submitted is valid and reachable.
We are working hard to keep the confirmation process as simple as possible.
To complete your registration, please visit this URL:
mail ($to,"Membership Activattion",$msg,$headers);
Now it's working perfectly.
Why it doesn't work if I removed the line above?
Re: I have a truoble in sending emails
Hmmm...
If you want to use header.. you can try :
PHP Code:
$Headers = "MIME-Version: 1.0\nContent-type: text/plain; charset=iso-8859-1\nFrom: \"YOUR SITE\"<YOUR-EMAIL>\nReply-To: \"YOUR SITE\" <YOUR-EMAIL>\nX-Priority: 3\nX-Mailer: PHP 4\n";
$Subject = "Email Subject";
$Content = "Email Message Content";
$To = "[email protected]";
mail($To, $Subject, $Content, $Header);
Re: I have a truoble in sending emails
It isn't working
Nothing has been sent.