douyi7283 2013-06-10 17:19
浏览 55

奖励空间电子邮件设置

I got a Award Space Mail Hosting account.I created that account only for the free email sending feature. Tried

PHP mailer
swiftmailer ect.. 

But no use.Can anyone give me a full working code of php and mail form,so that i can just test it in my server .I cound send emails when using this file :

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

But,i dont want that peace of code.I want a perfect code that can work on My server.

Sample code:(Has an html form submit form)

<?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>
”;
$headers .= “Reply-To: $name <$email>
”;

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

} else {

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

}
?>

Or i tried doing the same with php mailer:

<?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';

?>

I am doing something wrong. But cant figure out what. Can anyone help me out .

  • 写回答

1条回答 默认 最新

  • doushen4719 2014-04-12 08:49
    关注

    The 'from' header should be an existing email account inside your Email Manager of your Hosting Control Panel. as their FAQ says:

    Tip: Please note that the 'From' header should be an existing email account inside your Email Manager of your Hosting Control Panel.

    FAQ

    评论

报告相同问题?

悬赏问题

  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图