我找到正确的信息关于如何本地主机WAMP发送电子邮件。以及如何获得授权从特定授权电子邮件地址发送电子邮件以发送任何其他电子邮件地址。如何从本地WAMP服务器发送电子邮件发送电子邮件Gmail Hotmail等?
如何配置这整个步骤解释我细节,我已经在这里参观一些堆栈溢出回答以及博客文章,但都是非常混乱和老过时,所以它可能不工作。所以我需要Stack Overflow用户的帮助。谢谢。
我找到正确的信息关于如何本地主机WAMP发送电子邮件。以及如何获得授权从特定授权电子邮件地址发送电子邮件以发送任何其他电子邮件地址。如何从本地WAMP服务器发送电子邮件发送电子邮件Gmail Hotmail等?
如何配置这整个步骤解释我细节,我已经在这里参观一些堆栈溢出回答以及博客文章,但都是非常混乱和老过时,所以它可能不工作。所以我需要Stack Overflow用户的帮助。谢谢。
从localhost
配置工作电子邮件客户端是很繁琐的事,我已经花了挫折小时尝试它。最后我发现这种方式来发送邮件(使用WAMP,XAMPP等):
配置此设置hMailServer:
配置您的Gmail帐户,进行以下修改:
如果你想从你需要通过下面的步骤,以允许从外部到外部帐户交付另一台计算机发送电子邮件:
我应该知道如何在php脚本中使用此...配置后 – 151291
但请记住,没有像样的真正的邮件服务器会接受你的邮件,因为你看起来更像是一个垃圾邮件发送者而不是一个明智的质量邮件服务器。 – RiggsFolly
a) Open the "php.ini". For XAMPP,it is located in C:\XAMPP\php\php.ini. Find out if you are using WAMP or LAMP server. Note : Make a backup of php.ini file
b) Search [mail function] in the php.ini file.
You can find like below.
[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = localhost
; http://php.net/smtp-port
smtp_port = 25
; For Win32 only.
; http://php.net/sendmail-from
;sendmail_from = [email protected]
Change the localhost to the smtp server name of your ISP. No need to change the smtp_port. Leave it as 25. Change sendmail_from from [email protected] to your domain email address which will be used as from address..
So for me, it will become like this.
[mail function]
; For Win32 only.
SMTP = smtp.planetghost.com
smtp_port = 25
; For Win32 only.
sendmail_from = [email protected]
auth_username = [email protected]
auth_password = example_password
c) Restart the XAMPP or WAMP(apache server) so that changes will start working.
d) Now try to send the mail using the mail() function ,
mail("[email protected]","Success","Great, Localhost Mail works");
================================= ===============================================
另一种方式
Gmail服务器在SSL下使用SMTP身份验证。我认为这是没有办法用在该情况下mail()函数,所以你可能要检查这些替代品:
它们都支持SMTP认证下SSL。
我试试这个方法来配置 –
你是否意味着你已经尝试过? –
不,目前我按照此步骤进行配置.. –
以下是使用PHPmailer库发送电子邮件的最佳方式,这是唯一适用于我的方法。
require_once 'mailer/class.phpmailer.php';
$mail = new PHPMailer(); // create a new object
$mail->IsSMTP(); // enable SMTP
$mail->SMTPDebug = 1; // debugging: 1 = errors and messages, 2 = messages only
$mail->SMTPAuth = true; // authentication enabled
$mail->SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for GMail
$mail->Host = "smtp.gmail.com";
$mail->Port = 465; // or 587
$mail->IsHTML(true);
$mail->Username = "[email protected]";
$mail->Password = "xxxxxxx";
$mail->SetFrom("[email protected]");
$mail->AddAddress($to);
$logfile = dirname(dirname(__FILE__)) . '/mail.log';
try {
$mail->Body = $message;
$mail->Subject = $subject;
file_put_contents($logfile, "Content: \n", FILE_APPEND);
file_put_contents($logfile, $message . "\n\n", FILE_APPEND);
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Email has been sent";
}
} catch (Exception $e) {
#print_r($e->getMessage());
file_put_contents($logfile, "Error: \n", FILE_APPEND);
file_put_contents($logfile, $e->getMessage() . "\n", FILE_APPEND);
file_put_contents($logfile, $e->getTraceAsString() . "\n\n", FILE_APPEND);
}
以下是使用Sendmail通过wamp服务器从本地主机发送电子邮件的步骤。
C:\wamp\sendmail\sendmail.ini
smtp_server=smtp.gmail.com smtp_port=465 [email protected] auth_password=your_password
"C:\wamp\bin\php\php5.5.12\php.ini"
和 "C:\wamp\bin\apache\apache2.4.9\bin\php.ini"
设置sendmail_path **sendmail_path = “C:\瓦帕\ sendmail的\ sendmail.exe -t”
它肯定会奏效。
对我来说Fake Sendmail的作品。
怎么办:
1)编辑C:\wamp\sendmail\sendmail.ini:
smtp_server=smtp.gmail.com
smtp_port=465
[email protected]
auth_password=your_password
2)编辑php.ini
并设置sendmail_path
sendmail_path = "C:\wamp\sendmail\sendmail.exe -t"
就是这样。现在你可以测试一封邮件。
没有任何SMTP服务器发送邮件,使用此代码发送邮件....
click below for mail sending code
听人首先,你可以做到这一点不太安全的Gmail帐户发送邮件后与您的Gmail帐户
您可以使用此php.ini设置
;smtp = smtp.gmail.com
;smtp-port = 25
;sendmail_from = my gmail is here
而sendmail.ini设置
smtp_server = smtp.gmail.com
smtp_port = 465
smtp_ssl = auto
auth_username = my gmail is here
auth_password = password
hostname = localhost
you can try this changes and i hope this code sent mail....
如果你有WAMP的设置,不会发邮件,只有一对夫妇的事情要做。 1.找出你的isp的smtp服务器名称。 Gmail的东西是最有可能带来不必要的复杂 2.创建这样在你的“www”文件夹和编辑一个文件phpsetup.php:
<?php
phpinfo();
?>
这会给你什么WAMP使用手柄。 3.搜索php.ini文件。有可能是多余的。你想要的那个是影响上面文件输出的那个。 4.在最可能的php.ini中找到smtp地址。 5.输入您的浏览器localhost/phpsetup.php并向下滚动到smtp设置。它应该说'localhost' 6.编辑php.ini文件smtp设置为您的ISPs smtp服务器的名称。 检查它是否为您更改phpsetup.php。如果它工作完成,如果没有,你正在处理错误的文件。
这个问题应该在Wordpress网站上,但他们太过自己或者试图获得客户。;)
你不能从你的本地主机发送电子邮件。它需要smtp。 –
如何获取SMTP –