Need Help In PHP Mail
Posted: Sun Nov 22, 2009 1:39 am
Hi,
I would require an urgent help for mailing.
When I try to mail from my website email to my other website email; the email is sent successfully.
But, when I am trying to send an email from my website email to my gmail it fails.
I know it can be done using some manipulation in the PHP code. I had done that earlier but have missed the code
and am banging my head
like anything since the last 1 month.. Any one please help.
The php.ini settings are below:
[mail function]
; For Win32 only.
SMTP = mail.mywebsite.com
smtp_port = 25
; For Win32 only.
sendmail_from = contact_us@mywebsite.com
The code that i am using to send the mail is:
<?
$to = "ynsinghbtech@gmail.com";
$subject = "Your emal has been sent!";
$body = "This is a test";
if(mail($to,$subject,$body)){
echo "<b>PHP has sent your mail</b>";
}else{
echo "<b>PHP could not send your mail</b>";
}
?>
The error that i am receiving is:
Warning: mail() [function.mail]: SMTP server response: 503 This mail server requires authentication when attempting to send to a non-local e-mail address. Please check your mail client settings or contact your administrator to verify that the domain or address is defined for this server. in C:\webs\02_test\test.php on line 5
PHP could not send your mail.
Please Help.
I would require an urgent help for mailing.
When I try to mail from my website email to my other website email; the email is sent successfully.
But, when I am trying to send an email from my website email to my gmail it fails.
I know it can be done using some manipulation in the PHP code. I had done that earlier but have missed the code
The php.ini settings are below:
[mail function]
; For Win32 only.
SMTP = mail.mywebsite.com
smtp_port = 25
; For Win32 only.
sendmail_from = contact_us@mywebsite.com
The code that i am using to send the mail is:
<?
$to = "ynsinghbtech@gmail.com";
$subject = "Your emal has been sent!";
$body = "This is a test";
if(mail($to,$subject,$body)){
echo "<b>PHP has sent your mail</b>";
}else{
echo "<b>PHP could not send your mail</b>";
}
?>
The error that i am receiving is:
Warning: mail() [function.mail]: SMTP server response: 503 This mail server requires authentication when attempting to send to a non-local e-mail address. Please check your mail client settings or contact your administrator to verify that the domain or address is defined for this server. in C:\webs\02_test\test.php on line 5
PHP could not send your mail.
Please Help.