Sending an email via localhost in PHP -
i'm trying send email through php. gives following warning.
warning: mail() [function.mail]: failed connect mailserver @ "smtp.ntlworld.com" port 25, verify "smtp" , "smtp_port" setting in php.ini or use ini_set() in c:\wamp\www\wagafashion\customerside\bulkinquiry.php on line 1007
in php.ini, smtp has been changed follows.
[mail function] ; win32 only. smtp = smtp.ntlworld.com smtp_port = 25 ; win32 only. sendmail_from = tiny1999@gmail.com
after configuring php.ini, wamp restarted , gave above warning. other settings made send email via localhost in php?
use phpmailer instead: https://github.com/phpmailer/phpmailer
how use it:
require('./phpmailer/class.phpmailer.php'); $mail=new phpmailer(); $mail->charset = 'utf-8'; $body = 'this message'; $mail->issmtp(); $mail->host = 'smtp.gmail.com'; $mail->smtpsecure = 'tls'; $mail->port = 587; $mail->smtpdebug = 1; $mail->smtpauth = true; $mail->username = 'me.sender@gmail.com'; $mail->password = '123!@#'; $mail->setfrom('me.sender@gmail.com', $name); $mail->addreplyto('no-reply@mycomp.com','no-reply'); $mail->subject = 'subject'; $mail->msghtml($body); $mail->addaddress('abc1@gmail.com', 'title1'); $mail->addaddress('abc2@gmail.com', 'title2'); /* ... */ $mail->addattachment($filename); $mail->send();
Comments
Post a Comment