email - php mail function doesn't want to work -
i know you've got topic lot of times. thing spent week reading turorials this, , other websites. want make mail function work, does'nt want. operation system windows 8. use wamp apache,and tried ways send emails through smtp. tried gmail , yahoo. modified sendmail.ini , php.ini hundred times. tried phpmailer class, worked while, when tried implement in contact form, stoped work.now it's not working @ :). tried stunnel stuff well, nothing happened. try sort out simple mail function send email, first step.the page blank. doesn't give error, don't email. these settings @ moment.
php.ini file:
[mail function]
; win32 only.
smtp =localhost
smtp_port =25
; win32 only.
; http://php.net/sendmail-from
sendmail_from =myemail@gmail.com
; unix only. may supply arguments (default: "sendmail -t -i").
sendmail_path ="\""c:\wamp\sendmail\sendmail.exe\" -t"
sendmail.ini file:
smtp_server=smtp.gmail.com
; smtp port (normally 25)
smtp_port=587
auth_username=myemail@gmail.com
auth_password=password
i put port number 587, saw on last topic read. hoped helps. tried 25 , 465 before. question maybe sounds stupid. possible , smtp connection can affected, operation system or firewall of pc?? started learn know php, , cannot go forward, till don't solve issue. thank you
have yout tried using phpmailer? download https://github.com/phpmailer/phpmailer , include in code like:
include ("phpmailer/class.phpmailer.php"); include ("phpmailer/class.smtp.php"); $subject = "your mail subject"; $body = "your mail body"; $headers = "from: " . $emailfrom; // send mail $mail = new phpmailer(); $mail->issmtp(); // telling class use smtp // smtp configuration $mail->smtpauth = true; // enable smtp authentication $mail->host = "smtp.gmail.com"; // smtp server $mail->username = "myemail@gmail.com"; $mail->password = "your email password"; //$mail->port = 465; // optional if don't want use default $mail->from = "emailfrom@gmail.com"; $mail->fromname = "name of sender"; $mail->subject = $subject; $mail->msghtml($body); // add many want $mail->addaddress($emailto); // if want attach file, relative path //$mail->addattachment("images/phpmailer.gif"); // attachment $response= null; if(!$mail->send()) { $response = "mailer error: " . $mail->errorinfo; } else { $response = "message sent!"; }
Comments
Post a Comment