奖励空间电子邮件设置

时间:2013-06-10 17:19:17

标签: phpmailer email-integration php

我有一个Award Space Mail Hosting帐户。我只为免费电子邮件发送功能创建了该帐户。 试图

PHP mailer
swiftmailer ect.. 

但没有用。任何人都可以给我一个完整的php和邮件形式的代码,这样我就可以在我的服务器上测试它。我会在使用这个文件时发送电子邮件:

  

http://www.html-form-guide.com/php-form/php-form-validation.html

但是,我不想要代码的和平。我想要一个可以在我的服务器上运行的完美代码。

示例代码:(有一个html表单提交表单)

<?php
if(isset($_POST['submit'])) {

$myemail = “support@domain.dx.am”;
$subject = $_POST['subject'];
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$headers = “From:Contact Form <$myemail>\r\n”;
$headers .= “Reply-To: $name <$email>\r\n”;

echo “Your message has been sent successfully!”;
mail($myemail, $subject, $message, $headers);

} else {

echo “An error occurred during the submission of your message”;

}
?>

或者我尝试使用php邮件程序执行相同操作:

<?php
require 'filefolder/mailer/class.phpmailer.php';

$mail = new PHPMailer;

$mail->IsSMTP(); // Set mailer to use SMTP
$mail->Host = 'localhost'; // Specify main and backup server
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = 'support@whatever.dx.am'; // SMTP username
$mail->Password = 'mypassword'; // SMTP password


$mail->From = 'support@whatever.dx.am';
$mail->FromName = 'Support';

$mail->AddAddress('anything@gmail.com'… // Name is optional


$mail->WordWrap = 50; // Set word wrap to 50 characters
$mail->IsHTML(true); // Set email format to HTML

$mail->Subject = 'Here is the subject';
$mail->Body = 'This is the HTML message body <b>in bold!</b>';
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';

if(!$mail->Send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
exit;
}

echo 'Message has been sent';

?>

我做错了什么。但是无法弄清楚是什么。谁能帮我吗 。

1 个答案:

答案 0 :(得分:0)

&#39;来自&#39;标题应该是您的主机控制面板的电子邮件管理器中的现有电子邮件帐户。 正如他们的常见问题解答所说:

  

提示:请注意&#39;来自&#39;标题应该是您的主机控制面板的电子邮件管理器中的现有电子邮件帐户。

FAQ

相关问题