简体   繁体   English

使用localhost和MAMP发送电子邮件

[英]sending an email using localhost with MAMP

so basically I am trying to send an email over local host and the program I am using is MAMP. 所以基本上我想通过本地主机发送电子邮件,并且我使用的程序是MAMP。 I have looked this up online and done everything written however, this still won't work. 我已经在网上查找并完成了所写的所有内容,但这仍然行不通。 My Apache port is set to : 8888 my SQL port is set to: 3306 The function I have entered as php file to send emails is the one below: 我的Apache端口设置为:8888我的SQL端口设置为:3306我作为php文件输入的用于发送电子邮件的功能如下:

mail(
     $admin_email, $messaage,
     'Works!',
     'An email has been generated from your localhost, congratulations!');

furthermore, I have filled out all the send mail value as shown below: 此外,我已经填写了所有发送邮件的值,如下所示:

smtp_server=smtp.gmail.com
; smtp port (normally 25)

smtp_port=25
smtp_ssl=ssl
auth_username=my_email@gmail.com
auth_password=*******

hostname=localhost

Obviously - my email and password are filled out using my email and password. 显然-我的电子邮件和密码是使用我的电子邮件和密码填写的。 also i have altered the php.ini file as shown: 我也改变了php.ini文件,如下所示:

; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
;http://php.net/sendmail-path
sendmail_path = C:\Windows\System32\sendmail\ -t -i -f   my_email@gmail.com

Can someone tell me where my error is ? 有人可以告诉我我的错误在哪里吗? any help is much appreciated :) 任何帮助深表感谢 :)

[mail function]
; For Win32 only.
;SMTP = localhost
;smtp_port = 25

; For Win32 only.
;sendmail_from = don@tripleroi.com

; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
sendmail_path =/usr/sbin/sendmail -t -i -f  yourname@example.com

If you are use gmail then, 如果您使用的是gmail,

    'host' = 'ssl://smtp.gmail.com',
    'port' = '465',

Note : you must be login while sending mail 注意 :发送邮件时必须先登录

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM