Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
685 views
in Technique[技术] by (71.8m points)

php - Send email using phpmailer on GoDaddy hosting

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

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 protected]";
$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 protected]";
$email->FromName     = $_POST['txtName'];
$email->AddAddress('[email protected]');
$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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

GoDaddy has several limitations for its shared-hosting plans.

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

relay-hosting.secureserver.net

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.

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.

Read here: GoDaddy costumer service answer


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...