从localhost发送电子邮件不起作用

时间:2014-04-04 23:28:28

标签: php email sendmail.exe

一年前,我尝试启用从WAMP发送电子邮件作为localhost并失败。我刚刚做了另一次协同努力但又失败了。这就是我所做的,希望有人能帮助我。

由于WAMP未附带sendmail.exe,因此创建了一个文件夹c:\wamp\sendmail,并将DIR中显示的以下文件复制到其中:

Directory of c:\WAMP\sendmail
14-01-11  03:44 PM         1,112,064 libeay32.dll
18-06-11  01:10 AM           932,864 sendmail.exe
04-04-14  10:45 PM             2,123 sendmail.ini
14-01-11  03:44 PM           275,968 ssleay32.dll

此文件夹中的sendmail.ini设置如下,关键行为5(smtp_serversmtp_portdefault_domainauth_username和{{1 }}):

auth_password

smtp_server=smtp.gmail.com ; smtp port (normally 25) smtp_port=587 smtp_ssl=auto ; the default domain for this server will be read from the registry ; this will be appended to email addresses when one isn't provided ; if you want to override the value in the registry, uncomment and modify ;default_domain=localhost ; log smtp errors to error.log (defaults to same directory as sendmail.exe) ; uncomment to enable logging error_logfile=error.log ; create debug log as debug.log (defaults to same directory as sendmail.exe) ; uncomment to enable debugging ;debug_logfile=debug.log ; if your smtp server requires authentication, modify the following two lines auth_username=mynamegmail.com auth_password=mypassword php.ini c:\WAMP\bin\php\php5.4.3,{1}},一行改变了,即 php.ini

接下来,在sendmail_path ="\"c:\Wamp\sendmail\sendmail.exe\" -t"中创建sendmail.php文件,其中包含以下内容:

C:\wamp\www

在运行localhost的网络浏览器中,运行了sendmail.phpv,但邮件没有通过。

  • 为什么localhost没有按照<?php mail('receipient@yahoo.com','sample mail','sample content','From: sender@gmail.com'); ?>
  • 中的说明发送邮件
  • 有什么遗漏或错误吗?
  • sendmail.php加上其他sendmail.exe错了吗?
  • .dllphp.inisendmail.ini中的条目是否错误?

1 个答案:

答案 0 :(得分:0)

sendmail.ini

[sendmail的]

  

smtp_server = smtp.gmail.com

     

SMTP_PORT = 465

     

smtp_ssl = SSL

     

error_logfile = error.log中

     

debug_logfile =的debug.log

     

auth_username = [电子邮件] @ gmail.com

     

auth_password = [电子邮件密码]

     

pop3_server =

     

pop3_username =

     

pop3_password =

     

force_sender = [电子邮件] @ gmail.com

     

force_recipient = hostname = smtp.gmail.com

的php.ini

[邮件功能]

  

SMTP = smtp.gmail.com

     

smtp_port = 465

     

sendmail_path =“\”C:\ xampp \ sendmail \ sendmail.exe \“ - t”

     

mail.add_x_header =关