require_once '../include/class.phpmailer.php';
...
function sendEmailFromOferty($fullAnnouncementNo, $announcement,
$recipients) {
global $db, $websiteRoot;
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->Host = 'smtp.poczta.onet.pl';
$mail->SMTPAuth = true;
$mail->Username = 'jivanmukta';
$mail->Password = ...;
$mail->From = 'jivan...@poczta.onet.pl';
$mail->AddReplyTo('jivan...@poczta.onet.pl');
foreach (explode(',', $recipients) as $bcc) {
$mail->AddBCC($bcc);
}
$mail->IsHTML(true);
$mail->Subject = ...;
getAnnouncementYearMonthNo($fullAnnouncementNo, $year, $month, $no);
$mail->Body = emailMessage(false, $year, $month, $no);
$result = $db->query('SELECT file_name, picture FROM pictures
' .
"WHERE announcement_year = $year AND announcement_month =
$month AND announcement_no = $no");
@mkdir($websiteRoot . '/tmp/' . $fullAnnouncementNo);
while ($row = $result->fetch_row()) {
createPicture($websiteRoot . '/tmp',
$fullAnnouncementNo, $row[0], $row[1]);
$mail->AddAttachment("$websiteRoot/tmp/
$fullAnnouncementNo/$row[0]");
}
$result->close();
if (!$mail->Send()) {
return false;
}
removeDirectory($websiteRoot . '/tmp/' . $fullAnnouncementNo);
return true;
}
The problem is that although $mail->Send() returns not false, email is
not sent. I mean I don't receive any email from my account.
$recipients variable contains valid addresses separated by comma.
Please help.
I don't know what is wrong. My email account data are OK and the
account works
fine. Similar PEAR Mail usage works correctly, but I want to use
PHPMailer.
Thanks in advance.
Almost certainly the mail is being rejected as invalid by the system you
are sending it from.
Try the -f switch to mail..to set a valid envelope address, as covered
here a few days ago, and elsewhere.
Rodzaj nieruchomo¶ci: lokal
Forma w³asno¶ci: hipoteczna
Please help.
BTW, I use ISO-8859-2 encoding in emailMessage function:
$mail->Body = emailMessage(false, $year, $month, $no);
function emailMessage($cancel, $announcementYear, $announcementMonth,
$announcementNo, $useHTML = true) {
if ($useHTML) {
return
"<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01//EN' 'http://
www.w3.org/TR/html4/strict.dtd'>\n" .
"<html lang='pl'>\n" .
"<head>\n" .
'<title>' . ($cancel ? 'Anulowanie ogłoszenia' :
'Ogłoszenie') . "</title>\n" .
"<meta http-equiv='Content-Type' content='text/html;
charset=ISO-8859-2'>\n" .
"<meta http-equiv='Content-Language' content='pl-PL'>\n" .
"</head>\n" .
emailMessageBodyHTML($announcementYear,
$announcementMonth, $announcementNo, ($cancel ? 'ANULOWAĆ' :
'zamieścić')) .
'</html>';
} else {
return emailMessageBodyText($announcementYear,
$announcementMonth, $announcementNo, ($cancel ? 'ANULOWAĆ' :
'zamieścić'));
}
}
Did you set the charset for the email itself (NOT the HTML charset).
Also, what if your user can't accept html messages? You should also be
sending the same message in plain text.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstu...@attglobal.net
==================
> Also, what if your user can't accept html messages? You should also be
> sending the same message in plain text.
OK, I set AltBody now.
I would think that's what it's there for...
>> Also, what if your user can't accept html messages? You should also be
>> sending the same message in plain text.
> OK, I set AltBody now.