在GoDaddy托管上使用phpmailer发送电子邮件 [英] Send email using phpmailer on GoDaddy hosting

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

问题描述

我正在尝试使用GoDaddy发送电子邮件,但问题是我的代码无法正常工作.

I'm trying to send a email using the GoDaddy but the problem is my code isn't working.

我需要在GoDaddy上进行配置吗?这个想法是我有一个客户,他们有一个Gmail帐户.该网站具有表单,客户需要将所有已提交的联系信息接收到其gmail帐户.

Do I need to configure something on GoDaddy? The idea is I have a customer and they have a gmail account. The site has a form and the customer needs to receive all the submitted contact information to their gmail account.

我不知道该怎么做,尝试了三天都没有成功.

I have no idea how to do it and have tried for three days with no success.

这是我用来将电子邮件发送到帐户的代码:

This is the code that I'm using to send the emails to the account:

/* Instanciando as Bibliotecas Responsaveis pelo PHPMailer */
require_once '../PHPMailer/class.phpmailer.php';
require_once '../PHPMailer/class.smtp.php';


/* Instanciando a Classe de Email */
$email  = new PHPMailer();

/* Configurando o Email. */
$email->SMTPSecure   = "ssl";
$email->IsSMTP();
$email->SMTPAuth     = true;

$email->Host         = "smtpout.secureserver.net";
$email->Port         = 465;



$email->Username     = "email@example.com";
$email->Password     = "";
$email->IsHTML(true);


/* Configuracoes de quem Esta Mandando o Email. */
$email->SetFrom($_POST['txtEmail'], $_POST['txtName']);
$email->AddReplyTo($_POST['txtEmail'], $_POST['txtName']);
$email->From         = "email@example.com";
$email->FromName     = $_POST['txtName'];
$email->AddAddress('email@example.com');
$email->Subject      = 'Contact Us Email';
$email->Body         =  'Name : '           .$_POST['txtName'].             '<br/>'.
                        'Email : '          .$_POST['txtEmail'].            '<br/>'.
                        'Especialidade : '  .$_POST['txtEspecialidade'] .   '<br/>'.
                        'Phone : '          .$_POST['txtTelefone'].         '<br/>'.

                        'Message : '        .$_POST['txtComentario'];

/* Verificar se o Email foi Enviado com Sucesso */
if($email->Send()):
    $Mensagem = 'Email Enviado com Sucesso';
else:
    $Mensagem = 'Erro ao Enviar o Email '.$email->ErrorInfo;
endif;

/* Mostrar o Resultado. */
echo $Mensagem;

对不起,它是葡萄牙语.谢谢大家.

I'm sorry but it's in Portuguese. Thanks people.

推荐答案

GoDaddy的共享主机计划有一些限制.

GoDaddy has several limitations for its shared-hosting plans.

如果您尝试从GoDaddy主机发送电子邮件,则需要使用以下SMTP服务器:

If you're trying to send emails from the GoDaddy host, you'll need to use the following SMTP server:

relay-hosting.secureserver.net

此外,请记住GoDaddy SMTP服务器非常繁忙,这意味着您可能需要一些时间才能将电子邮件发送给收件人.

Also, keep in mind that the GoDaddy SMTP servers are very busy, which means it might take some time until your email sent to its recipient.

不要浪费时间,并尝试配置其他SMTP服务器(Gmail等)来处理您的外发电子邮件. GoDaddy阻止了此选项,并将其限制为仅上述服务器.

Don't waste your time and try to configure other SMTP servers (Gmail etc) to handle your outgoing emails. GoDaddy has blocked this option and limited it only to the mentioned server above.

在此处阅读: 查看全文

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