Jump to content

[SOLVED] sending email error


jim.davidson

Recommended Posts

Could someone tell me why I'm getting this error?  Any help will be appreciated!

 

Warning: mail() [function.mail]: SMTP server response: 501 5.5.4 Invalid Address in

 

Here's my code,

 

  // initialize variables

  $to = $email;

  $subject = 'Message from MyWeb Site';

  // build the message

 

  $message = "From: My Site\n";

  $message .= "Email: [email protected]\n\n";

  $message .= "Dear $name:\n\n";

  $message .= "Thank you for inquiring r\n";

  $message .= "We will contact you at the time you have indicated to discuss details, answer questions and plan your\n";

  $message .= "experience.\n\n\n";

  $message .= "Warm Regards\n\n";

  $message .= "Jim D\n";

 

  // build additional headers

 

    $additionalHeaders = "From: My Web Site\r\n";

 

  $additionalHeaders .= "Reply-To: [email protected]";

  // send the mail if there are no errors

  if (!isset($error)) {

 

      $mailSent = mail($to, $subject, $message, $additionalHeaders);

 

// check to see if sent successfully

if (!$mailSent) {

  $error['notSent'] = 'Sorry there is a problem sending your message.  Please try later.';

}

else {

  $sent = true;

}

  }

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/150764-solved-sending-email-error/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.