I have a problem sending email via PHP / IMAP - and I don't know if this was because:
- I misunderstand IMAP, or
- Problem with my server
My application opens an IMAP connection with an email account to read messages in the inbox. He does it successfully. The problem is that I want to send messages from this account and display them in the send / send folder.
As far as I can tell, the PHP imap_mail () function has nothing to do with the IMAP stream that I am currently opening.
My code runs without error. However, the message never arrives at the recipient and never appears in my folder.
private function createHeaders() {
return "MIME-Version: 1.0" . "\r\n" .
"Content-type: text/html; charset=iso-8859-1" . "\r\n" .
"From: " . $this->accountEmail . "\r\n";
}
private function notifyAdminForCompleteSet($urlToCompleteSet) {
$message = "
<p>
In order to process the latest records, you must visit
<a href='$urlToCompleteSet'>the website</a> and manually export the set.
</p>
";
try {
imap_mail(
$this->adminEmail,
"Alert: Manual Export of Records Required",
wordwrap($message, 70),
$this->createHeaders()
);
echo(" ---> Admin notified via email!\n");
}
catch (Exception $e) {
throw new Exception("Error in notifyAdminForCompleteSet()");
}
}
, IMAP ... ?
, , "" , script? , .