【发布时间】:2013-12-04 11:54:54
【问题描述】:
在我的网站上,我有一个简单的联系表,但我不知道为什么我不能发送电子邮件。
HTML:
<form id="contactForm" method="post" action="js/sendmail.php" >
<fieldset>
<p><label for="name" class="label">Name*:</label>
<input type="text" name="name" id="Text1" class="input required" />
</p>
<p><label for="email" class="label">Email*: </label>
<input type="email" name="email" id="contact_email" class="input email required" />
<span class="input_feedback"></span>
</p>
<p>
<label class="label">Your message*: </label>
<textarea class="textarea required" name="message" rows="10" cols="50" ></textarea>
</p>
<p class="submitButtons">
<input type="submit" value="Send email" id="senEmail" class="button"/>
</p>
</fieldset>
</form>
PHP:
<?php
include('class.phpmailer.php');
include("class.smtp.php");
session_set_cookie_params('3600'); // 1 hour
session_start();
$mail->SMTPSecure = "ssl";
$mail->SMTPKeepAlive = true;
$mail->Mailer = "smtp";
$mail = new PHPMailer(); // create a new object
$mail->SMTPDebug =2;
$mail->IsSMTP(); // send via SMTP
$mail ->Host = 'mrvnet.kundenserver.de';
$mail->Port= 465;
$mail->SMTPAuth = true;
$mail->Username = 'info@brightongatwicktransfer.com';
$mail->Password = '******';
$mail->SetFrom('myName@yahoo.com');
$mail->Subject = "Test";
$mail->Body = "Something";
$mail->AddAddress('info@brightongatwicktransfer.com');
if(!$mail->Send())
{ echo "Mailer Error: " . $mail->ErrorInfo;}
else
{ echo "Message has been sent";}
?>
我尝试了 'ssl' 和 'tls' 但没有结果。
主机公司说主机是正确的,并要求我尝试使用 587 和 25 端口,但我总是收到同样的错误:
2013-12-04 11:40:00 SMTP 错误:无法连接到服务器:连接尝试
由于连接方在一段时间后没有正确响应而失败,或
建立连接失败,因为连接的主机没有响应。 (10060)
SMTP 连接()失败。邮件程序错误:SMTP 连接()失败。
【问题讨论】:
标签: phpmailer