QEmailServer with QEmailAttachment
Tue, 11/23/2010 - 23:00
I'm having a problem using QEMailServer with a QEmailAttachment. When the email is sent the attachment is being sent as a string of base64 encoded data, rather than an attached file. Here's the relevant code:
$objAttachment = new QEmailAttachment($filenamepath,QMimeType::Pdf,$txtReportName);
$objMessage->AddAttachment($objAttachment);$filenamepath contains the full path name to the file and $txtReportName contains the filename. What am I missing here?
Thanks.

This is working code I have in production
$attCreditAuth = __DOCROOT__ . __SUBDIRECTORY__ . '/docs/Credit_Auth_one_time.pdf';$strMessage = Blurb::LoadByShortDescription('FNMA_REQ_EMAIL_TEXT')->LongDescription;
$objMessage = new QEmailMessage(__ADMIN_EMAIL__, $objUserAccount->EmailAddress, 'FNMA Credentials Request', $strMessage);
$objMessage->HtmlBody = $strMessage;
$objMessage->Attach($attCreditAuth, QMimeType::Pdf, 'Credit_Auth_FNMA_REQ_' . $objUserAccount->Username . '.pdf');
AFCEmailServer::Send($objMessage);
Steven:
I'm still getting the same results. I notice you're calling AFCEMailServer. Do you have a modified version of QEMailServer?
QEmailServer is being retired from the framework due to its terrible instability (see http://trac.qcu.be/projects/qcubed/ticket/654). I personally switched to PHPMailer. Vexed switched to Zend_Mail. I recommend you do the same.
LaCeja, AFCEMailServer overrides QEMailServer and initializes a few variables. I am having no issues with that code with QCubed 1.1.2 running on both Windows(dev) and Ubuntu(prod).
There should be a note in the examples telling us that, so we don't spend a huge amount of time trying to make it work.