私は現在、ウェブサイトを立ち上げて、バーチャルカンパニーのために働いています。私は研究しており、どこにでも答えを見つけることができません。電子メールを送信するPHPMailerでGoDaddyホスティングを使用する?
ユーザーがサインアップすると、会社の概要を説明する電子メールが届きます。ここで私が使用したコードである(は、はい、$ _SESSION変数の値を持っている)
<?php
session_start();
require '../../PHPMailer/PHPMailerAutoload.php';
$EmailUsername = $_SESSION['Username'];
$EmailFirstName = $_SESSION['FirstName'];
$EmailEmail = $_SESSION['Email'];
$mail = new PHPMailer;
//$mail->SMTPDebug = 3; // Enable verbose debug output
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'localhost'; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = '[email protected]'; // SMTP username
$mail->Password = '#Password'; // SMTP password
$mail->SMTPSecure = 'ssl'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 25; // TCP port to connect to
$mail->setFrom('[email protected]', 'No-Reply');
$mail->addAddress($EmailEmail, $EmailFirstName); // Add a recipient
$mail->addAddress(''); // Name is optional
$mail->addReplyTo('', '');
$mail->addCC('');
$mail->addBCC('');
$mail->addAttachment(''); // Add attachments
$mail->addAttachment(''); // Optional name
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = 'Ozzie Transport Signup';
$mail->Body = "Hello, $EmailUsername.
<br><br>
Welcome to <b>Ozzie Transport.</b> A Virtual Trucking Company Utilising Truckers MP’s Multiplayer's Servers on Both American Truck Simulator and European Truck Simulator 2.
<br><br>
<b>Ozzie Transport</b> was founded by <i>Mr. Will Lads</i> and <i>Mr. Jacob Findlater</i>. Who where major assets to Ozzie Transport's Beginning.
<br><br>
Your Account is in the process of activation by our current Driver Manager. <i>Luc Jones</i>, You may log into your account using the Username and Password given in your Sign Up Application.
<br><br>
<b>Username:</b> <i>$EmailUsername.</i>
<br><br>
<b><i>If you have any questions, please reply to this email. We would be happy to hear from you.</i></b>
<br><br>
<b>Kind Regards</b>
<br><b><i>Joshua Micallef<br>
Chief Executive Officer - Ozzie Transport
";
if(!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent';
}
session_destroy();
//header("Location: ../../Login.php");
私は、コードを実行するたびに、それは私に次のエラーメッセージを表示します。メッセージはsent.Mailerエラーことができませんでした:SMTP connect()に失敗しました。 https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting。
誰もが何か考えを持って、私はまだこれについて疑問に思う人々がいると思います。
Gmailのローカルホストサーバーでメールを送信することはできましたが、公式サイトではできませんでした。これらの設定は私のために何も変わっていないようだ、私は彼らと一緒にサポートチケットを開き、彼らが何を言わなければならないかを見るだろう。あなたの落ち着いた応答、ありがとうございます – JoshuaMicallef
あなたはあなたがログインした後、あなたのホスティングアカウントのどこかで正しい設定を見つけることができるかもしれません。 – Difster