[英]Send mail from localhost
I want to know if it is possible to send emails from localhost. 我想知道是否可以从本地主机发送电子邮件。 If yes, how?
如果是,怎么办? I want to send emails from my localhost using my gmail account.
我想使用gmail帐户从本地主机发送电子邮件。 I have a Mac OS X Yosemite Version 10.10.1 and I am running XAMPP 5.6.3-0.
我有Mac OS X Yosemite版本10.10.1,并且正在运行XAMPP 5.6.3-0。
Thanks! 谢谢!
You can use PHP mailer and not configure SMTP on your machine or you can follow this instructions to configure sendmail with GMAIL . 您可以使用PHP邮件程序而不在计算机上配置SMTP,也可以按照以下说明使用GMAIL配置sendmail。 I like option 2 :) (Just for fun).
我喜欢选项2:)(只是为了好玩)。 Of course the first option is easier.
当然,第一种选择更容易。
C:\\xampp\\
. C:\\xampp\\
。 php.ini
file which contains the configurations belong to PHP. php.ini
文件,其中包含属于PHP的配置。 This file by default is located at C:\\xampp\\php\\php.ini
. C:\\xampp\\php\\php.ini
。 Open it using any text editor like notepad. sendmail_path
. sendmail_path
。 There should be two of them. ;
;
(semicolon) in the beginning of the line , and the other one is not commented. sendmail_path = "\\"C:\\xampp\\sendmail\\sendmail.exe\\" -t" ; XAMPP: Comment out this if you want to work with mailToDisk,... ;sendmail_path="C:\\xampp\\mailtodisk\\mailtodisk.exe"
sendmail_path = "\\"C:\\xampp\\sendmail\\sendmail.exe\\" -t" ; XAMPP: Comment out this if you want to work with mailToDisk,... ;sendmail_path="C:\\xampp\\mailtodisk\\mailtodisk.exe"
sendmail_path = "\\"C:\\xampp\\sendmail\\sendmail.exe\\" -t" ; XAMPP: Comment out this if you want to work with mailToDisk,... ;sendmail_path="C:\\xampp\\mailtodisk\\mailtodisk.exe"
php.ini
file and restart the Apache process. php.ini
文件并重新启动Apache进程。 This is necessary for the configuration to take place. C:\\xampp\\sendmail
and open the sendmail.ini
in the text editor. C:\\xampp\\sendmail
并在文本编辑器中打开sendmail.ini
。 smtp.gmail.com
and the SMTP port for Gmail is 587 . smtp.gmail.com
,Gmail的SMTP端口为587 。 smtp_server
and write the Gmail SMTP address in front of that. smtp_server
并在其前面写下Gmail SMTP地址。 smtp_port
and write the Gmail SMTP port in front of that. smtp_port
并在其前面写入Gmail SMTP端口。 auth_username
& auth_password
. auth_username
和auth_password
。 Put your gmail username in front of auth_username and put the password in front of auth_password . Save and now you are good to send mail from local host. 保存,现在您可以从本地主机发送邮件了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.