I'm currently working on getting a website up and running for my Virtual Company, I have been researching and can't find the answer to this anywhere.
When a user Signs up, I want them to receive an email giving a brief outline of the company. Here is the code that I use (And Yes, the $_SESSION Variables do have Values)
<?phpsession_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 = 'no-reply@ozzietransport.org'; // 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('no-reply@ozzietransport.org', '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");
Every time I run the code it gives me the following error Message: Message could not be sent.Mailer Error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting.
Anyone got any ideas, I believe there are still people wondering about this.