phpmailer不在同一域上发送电子邮件 [英] Phpmailer not sending email on same domain

查看:70
本文介绍了phpmailer不在同一域上发送电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网站,并且有一个联系表.我的下面的代码:

I have a website and there is a contact form. My code below :

$name = $_POST['name'];
$email = $_POST['email'];

$mail = new PHPMailer(true);

if (!$mail->addAddress('email@domain.com','email')) {
  die('Invalid email address');
}
$mail->isSMTP();
//$mail->SMTPAuth = true;
$mail->SMTPDebug = 2;
$mail->Host = 'localhost';
$mail->Subject = 'Subject';
$text = 'A mail...';
$mail->MsgHTML($text);
$mail->SetFrom($email);
//$mail->AddReplyTo($email,$name);

if ($mail->Send()){

如果用户输入自己的邮件地址(例如"address@gmail.com"或"add@hotmail.com"),则会将电子邮件发送到该地址.但是,如果我输入my@mydomain.com,则会显示消息发送,但是邮件没有到达.我正在搜索2天,但找不到合适的解决方案.我也尝试过:

If user enter his/her mail adress like 'address@gmail.com' or 'add@hotmail.com', it sends email to that address.But if I enter my@mydomain.com, it says message send, but mail is not arrived. I'm searching for 2 days but can not found proper solution. I did also try this:

我写了$ mail-> addAddress('mybackupmail@gmail.com','email'),然后将收到的邮件转发到mybackupmail@gmail.com到'mydomain@domain.com'.它也没有发送.我几乎尝试了一切.我的mx记录如下:

I wroted $mail->addAddress('mybackupmail@gmail.com','email'), and I forwarded the incoming mail to mybackupmail@gmail.com to 'mydomain@domain.com'. It is also not sending. I almost tried everything. My mx records like below:

我应该更改这些设置吗?还是其他问题?

Should I change these settings or not? Or the problem with sth else?

非常感谢您的帮助.

感谢您的关注,

推荐答案

您是否正在使用与Godaddy托管的cpanel?我不知道这是无处不在的面板",还是只是哥达,而在您的面板中寻找一个名为"MX Entry"的东西,然后将其从本地更改为远程.本地告诉服务器我们是此cpanel中此域的邮件引擎",而远程告诉服务器此域的电子邮件在cpanel之外处理" ...您的MX记录告诉我您正在使用工作区电子邮件,因此您需要MX Entry到远程:)

Are you using a cpanel hosting with godaddy? I dunno if this is "cpanel everywhere", or just at godaddy, but go into your cpanel and look for a thing called "MX Entry" then change it from local to remote. Local tells the server "we are the mail engine for this domain that we have here in this cpanel", and remote tells it "the email for this domain is handled outside of cpanel" ... your MX records tell me you're using workspace email, thus you need MX Entry to remote :)

这篇关于phpmailer不在同一域上发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆