Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => Mail

Mail function using sendmail

the mail() function

Moderators: macek, egami, gesf

Mail function using sendmail

Postby dmajumdar82 » Sun Jan 06, 2013 5:31 am

hi,
I am new in php domain,wants to send mail to my gmail account from another gmail account.
I am using Xampp 1.7.1 from win 7 .After several changes that I have made in php.ini and sendmail.ini now my mail function returns true value but no mail is actually sent in my mailbox and a message
Connect timed out.
is shown in error.log under sendmail foldder.
the code of my mail.php is given below
<?php
$MailToAddress = "debasri28@gmail.com";
$MailSubject = "Subject goes here";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
if (!mail($MailToAddress, $MailSubject, "hello",$headers))
echo "Error sending e-mail!";
else
echo "e-mail! is sent";
?>


In php.ini parameters are----

SMTP = ssl://smtp.gmail.com //smtp.gmail.com
smtp_port =587
sendmail_from = mymail@gmail.com
auth_username = mymail@gmail.com
auth_password=xxxxxxxx
sendmail_path = "C:\xampp\sendmail\sendmail.exe -t"


In sendmail.ini parameters are----
[color=#40FFFF]smtp_server=smtp.gmail.com
smtp_port=587
smtp_ssl=auto
error_logfile=error.log
debug_logfile=debug.log
auth_username=mymail@gmail.com
auth_password=xxxxxxxx
force_sender=mymail@gmail.com
[/color]

Please Please help me! :help:
Thank you
dmajumdar82
New php-forum User
New php-forum User
 
Posts: 1
Joined: Wed Jan 02, 2013 11:21 pm

Re: Mail function using sendmail

Postby aravindoptimus » Thu Mar 07, 2013 2:07 am

Its Simple from Localhost we cant send mail :(... Try the file from server.. It will work :D
User avatar
aravindoptimus
New php-forum User
New php-forum User
 
Posts: 11
Joined: Thu Mar 07, 2013 2:00 am


Return to PHP coding => Mail

Who is online

Users browsing this forum: No registered users and 3 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.