我的功能就像是,用户注册他的帐户并发送电子邮件给他以激活他的帐户。用户单击其电子邮件中的该链接并激活其帐户。
我以各种方式更改了php.ini
:例如,我更改了sendmail.php
smtp_server=smtp.gmail.com
smtp_port=465 //i also changed it to 587 to test
auth_username=me@gmail.com
auth_password=mypassword
force_sender=me@gmail.com
hostname=smtp.gmail.com //i tried it by leaving it blank
I changed my php.ini to this and close my apache , th i restart it to configure .
SMTP = smtp.gmail.com
smtp_port = 465 //i changed it 587 as well
sendmail_path="\"C:\xampp\sendmail\sendmail.exe\"-t"
我关闭了防病毒软件,我使用的是php 5.6.3和xampp服务器3.2.1,我使用的是Windows 7家庭高级版。
我的PHP代码在这里
我在register_user
中使用了这一行函数。
email($register_data['email'],'Active your account',"\n\n hello".$register_data['first_name']. ",you need to activate your account below:\n\n http:/localhost/lr/active.php?email=" .$register_data['email']."email_code=".$register_data['email_code']." \n\n -auto hire edge");
I m using this function to send mail
function email($to, $subject, $body)
{
mail($to , $subject , $body, 'From: hello@gmail.com');
}
请告诉我是否做错了什么?