Jump to content

Recommended Posts

Here is the code I have to process a contact form:

<?php
  // DEFINE VARIABLE AND SET EMPTY VALUES
  $varfnameErr = $varlnameErr = $varemailErr = $varphoneErr = $varmessageErr = "";
  $varfname = $varlname = $varemail = $varphone = $varmessage = $varipaddress = $formerror = $success = "";
  
  $varfnameErr = $_REQUEST['varfnameErr'] ;
  $varlnameErr = $_REQUEST['varlnameErr'] ;
  $varemailErr = $_REQUEST['varemailErr'] ;
  $varphoneErr = $_REQUEST['varphoneErr'] ;
  $varmessageErr = $_REQUEST['varmessageErr'] ;
  
  $varfname = $_REQUEST['varfname'] ;
  $varlname = $_REQUEST['varlname'] ;
  $varemail = $_REQUEST['varemail'] ;
  $varphone = $_REQUEST['varphone'] ;
  $varmessage = $_REQUEST['varmessage'] ;
  $varipaddress = $_REQUEST['varipaddress'] ;

  $message = '<html><body>';
  $message .= '<p>Form submitted by: ' .$varfname. ' ' .$varlname. '</p>';
  $message .= '<p>Email: ' .$varemail. '</p>';
  $message .= '<p>Phone Number: ' .$varphone. '</p>';
  $message .= '<p>Message: ' .$varmessage. '</p>';
  $message .= '<p>IP Address: ' .$varipaddress. '</p>';
  $message .= '</body></html>';

  use PHPMailer\PHPMailer\PHPMailer;
  use PHPMailer\PHPMailer\Exception;
  
  require $_SERVER['DOCUMENT_ROOT'] . '/mail/Exception.php';
  require $_SERVER['DOCUMENT_ROOT'] . '/mail/PHPMailer.php';
  require $_SERVER['DOCUMENT_ROOT'] . '/mail/SMTP.php';
  
  $mail = new PHPMailer;
  $mail->isSMTP(); 
  $mail->SMTPDebug = 2; // 0 = off (for production use) - 1 = client messages - 2 = client and server messages
  $mail->Host = "HostIsBlueHost"; // use $mail->Host = gethostbyname('smtp.gmail.com'); // if your network does not support SMTP over IPv6
  $mail->Port = 21; // TLS only
  $mail->SMTPSecure = 'tls'; // ssl is deprecated
  $mail->SMTPAuth = true;
  $mail->Username = 'info@aacroofing.org'; // email
  $mail->Password = 'PasswordWasHere'; // password
  $mail->setFrom($varemail); // From email and name
  $mail->addAddress('test@gmail.com'); // to email and name

  $mail->Subject = 'Contact Us Form Submission';
  $mail->msgHTML($message); //$mail->msgHTML(file_get_contents('contents.html'), __DIR__); //Read an HTML message body from an external file, convert referenced images to embedded,
  $mail->AltBody = 'HTML messaging not supported'; // If html emails is not supported by the receiver, show this body
  //$mail->addAttachment('images/phpmailer_mini.png'); //Attach an image file
  $mail->SMTPOptions = array(
    'ssl' => array(
    'verify_peer' => false,
    'verify_peer_name' => false,
    'allow_self_signed' => true
    )
  );
  
  if(!$mail->send()){
    echo "Mailer Error: " . $mail->ErrorInfo;
  }else{
    $success = "<p class='success'>Message sent! Thank you!</br>IP Address: " .$varipaddress. " recorded</p>";
    $varfname = $varlname = $varemail = $varphone = $varmessage = "";
  }
?>

 

When the form is completed and submitted this is the error that I get.  I have no idea what this means.  If someone understands the error, could you please give me a clue?

2020-03-08 19:48:46 SERVER -> CLIENT: 220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------220-You are user number 1 of 150 allowed.220-Local time is now 13:48. Server port: 21.220-IPv6 connections are also welcome on this server.220 You will be disconnected after 15 minutes of inactivity.
2020-03-08 19:48:46 CLIENT -> SERVER: EHLO aacroofing.org
2020-03-08 19:48:46 SERVER -> CLIENT: 530 You aren't logged in
2020-03-08 19:48:46 SMTP ERROR: EHLO command failed: 530 You aren't logged in
2020-03-08 19:48:46 CLIENT -> SERVER: HELO aacroofing.org
2020-03-08 19:48:46 SERVER -> CLIENT: 530 You aren't logged in
2020-03-08 19:48:46 SMTP ERROR: HELO command failed: 530 You aren't logged in
2020-03-08 19:48:46 CLIENT -> SERVER: STARTTLS
2020-03-08 19:48:46 SERVER -> CLIENT: 530 You aren't logged in
2020-03-08 19:48:46 SMTP ERROR: STARTTLS command failed: 530 You aren't logged in
SMTP Error: Could not connect to SMTP host.
2020-03-08 19:48:46 CLIENT -> SERVER: QUIT
2020-03-08 19:48:46 SERVER -> CLIENT: 221-Goodbye. You uploaded 0 and downloaded 0 kbytes.221 Logout.
SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
Mailer Error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

Link to comment
https://forums.phpfreaks.com/topic/310235-phpmailer-error-results/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.