0

I am writing a support ticket site and need email functionality (PEAR) and I keep getting this issue:

"No From: address has been provided" below is part of the script showing where I think the issue is, please note: Sensitive information has been removed/redacted.

Thanks:

$replyto = "REDACTED";
$host = "REDACTED";
 $username = "REDACTED";
 $password = "REDACTED";
 $mime = '1.0';
 $content = 'text/html; charset=ISO-8859-1';
$subject = $subject;
$mime = "1.0";
$content = "text/html; charset=ISO-8859-1";
$headers = array ('From ' => $replyto,
'To ' => $to,
'Reply-To ' => $replyto,
'Mime-Version ' => $mime,
'Subject: ' => $subject,
'Content-Type' => $content);

$smtp = Mail::factory('smtp', array('host'=>$host,
'auth'=> true,
'username' => $username,
'password' => $password));

$mail = $smtp->send($to,$headers,$body);

if(PEAR::isError($mail)) {
    echo "ERROR: Could not send email: " . $mail->getMessage();
} else {
    $url = "http://support.myfallen.net/ticket.php?id=" . $internalId . "&successCode=1";
    header('Location:' . $url);
}
NoMansLand
  • 39
  • 2
  • 10

1 Answers1

2

For some strange reasons all the keys in your $params array end with ' ' - a whitespace symbol. I.e., instead of...

array ('From ' => $replyto, ...

... it should be ...

array ('From' => $replyto, ...

The same for all the other keys ('To' instead of 'To ', 'Reply-To' instead of 'Reply-To ', 'Subject' for 'Subject: ' etc.).

raina77ow
  • 103,633
  • 15
  • 192
  • 229