首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >从本地主机发送电子邮件不起作用

从本地主机发送电子邮件不起作用
EN

Stack Overflow用户
提问于 2014-04-04 23:28:28
回答 1查看 738关注 0票数 0

一年前,我尝试将WAMP的电子邮件作为本地主机发送,但失败了。我刚刚又做了一次协调一致的努力,但还是失败了。这就是我所做的,希望有人能帮我一把。

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

代码语言:javascript
复制
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_usernameauth_password):

代码语言:javascript
复制
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 of c:\WAMP\bin\php\php5.4.3php.ini中,有一行被修改,即sendmail_path ="\"c:\Wamp\sendmail\sendmail.exe\" -t"

接下来,在sendmail.php中创建一个C:\wamp\www文件,其内容如下:

代码语言:javascript
复制
<?php
mail('receipient@yahoo.com','sample mail','sample content','From: sender@gmail.com');
?>

在运行本地主机的web浏览器中,运行了`sendmail.phpv,但邮件没有通过。

  • 为什么本地主机没有按照sendmail.php中的指示发送邮件
  • 有什么遗漏或错误吗?
  • sendmail.exe加其他.dll是错的吗?
  • php.inisendmail.inisendmail.php中的条目是错误的吗?
EN

回答 1

Stack Overflow用户

发布于 2016-09-22 07:34:34

sendmail.ini

寄信

smtp_server=smtp.gmail.com smtp_port=465 smtp_ssl=ssl error_logfile=error.log debug_logfile=debug.log auth_username=email@gmail.com auth_password=email密码 pop3_server= pop3_username= pop3_password= force_sender=email@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=Off

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/22874671

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档