PEAR Forum :: PHP Extension and Application Repository

PEAR Forum Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
newbie: sending email

 
Post new topic   Reply to topic    PEAR Forum Forum Index -> Mail
View previous topic :: View next topic  
Author Message
RAM



Joined: 10 May 2010
Posts: 2

PostPosted: Thu May 13, 2010 5:15 am    Post subject: newbie: sending email Reply with quote

Hello,
I have a function sending email with attachment:

function sendEmail($to, $recipients, $subject, $bodyText, $bodyHTML, $fullAnnouncementNo, $withAttachments, $logEntry) {

global $db, $websiteRoot, $currentAdmin;
$emailFrom = file_get_contents('.email_from.txt');

$headers['From'] = $emailFrom;

$headers['Reply-To'] = $emailFrom;

$headers['Subject'] = $subject;

$headers['MIME-Version'] = '1.0';

$headers['Content-type'] = 'text/html; charset=ISO-8859-2';

$headers['X-Mailer'] = 'PHP';

$headers['Content-Transfer-Encoding'] = 'quoted-printable';
$params['host'] = 'localhost';
if (!empty($fullAnnouncementNo)) {

getAnnouncementYearMonthNo($fullAnnouncementNo, $year, $month, $no);

}

$mime = new Mail_mime("\n");

$mime->setHTMLBody($bodyHTML);
// $bodyText

if ($withAttachments && !empty($fullAnnoucementNo)) {

$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]);

$mime->addAttachment("$websiteRoot/tmp/$fullAnnouncementNo/$row[0]");

}

$result->close();
}
$mailObject =& Mail::factory('mail', $params);
$sent = $mailObject->send(array('Bcc' => explode(',', $recipients)), $mime->headers($headers), $mime->get());

if (!empty($fullAnnouncementNo)) {

writeToLog(null, null, $currentAdmin, $year, $month, $no, $logEntry);

} else {

writeToLog(null, null, $currentAdmin, null, null, null, $logEntry);

}

return !PEAR::isError($sent);

}


The problem is that I do not receive the email.
I don't know what's wrong in my function.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    PEAR Forum Forum Index -> Mail All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



PEAR Forum topic RSS feed 
Powered by phpBB © 2001, 2005 phpBB Group

Provided by Ministry of Web developement