Hello,
I have the below code and it will allow attachments to be sent with email, but images are not sent, just gives link to images.
$from = tep_db_prepare_input($HTTP_POST_VARS['from']);
$from_name = tep_db_prepare_input($HTTP_POST_VARS['from_name']);
$subject = tep_db_prepare_input($HTTP_POST_VARS['subject']);
$message = tep_db_prepare_input($HTTP_POST_VARS['message']);
if (isset($GLOBALS['userfile']) && tep_not_null($GLOBALS['userfile']))
{ $attachment_name = $HTTP_POST_FILES['userfile']['name'];
$attachment_type = $HTTP_POST_FILES['userfile']['type'];
//$attachment_size = $HTTP_POST_FILES['userfile']['size']; //Just in case you want to check and limit the size
new upload('userfile', DIR_FS_DOWNLOAD);
$attachment_file = DIR_FS_DOWNLOAD . $attachment_name;
$attachments = $mimemessage->get_file($attachment_file);
$mimemessage->add_attachment($attachments, $attachment_name, $attachment_type);
}
$mimemessage->add_text($message);
$mimemessage->build_message();
while ($mail = tep_db_fetch_array($mail_query)) {
$mimemessage->send($mail['customers_firstname'] . ' ' . $mail['customers_lastname'], $mail['customers_email_address'], '', $from, $subject);
};
tep_redirect(tep_href_link(FILENAME_MAIL, 'mail_sent_to=' . urlencode($mail_sent_to)));
If I use this code, it sends images, but attachments are not sent?? Can someone let me know what I am missing.
$from = tep_db_prepare_input($HTTP_POST_VARS['from']);
$from_name = tep_db_prepare_input($HTTP_POST_VARS['from_name']);
$subject = tep_db_prepare_input($HTTP_POST_VARS['subject']);
$message = tep_db_prepare_input($HTTP_POST_VARS['message']);
if (isset($GLOBALS['userfile']) && tep_not_null($GLOBALS['userfile']))
{ $attachment_name = $HTTP_POST_FILES['userfile']['name'];
$attachment_type = $HTTP_POST_FILES['userfile']['type'];
//$attachment_size = $HTTP_POST_FILES['userfile']['size']; //Just in case you want to check and limit the size
new upload('userfile', DIR_FS_DOWNLOAD);
$attachment_file = DIR_FS_DOWNLOAD . $attachment_name;
$attachments = $mimemessage->get_file($attachment_file);
$mimemessage->add_attachment($attachments, $attachment_name, $attachment_type);
}
$mimemessage->add_text($message);
$mimemessage->build_message();
while ($mail = tep_db_fetch_array($mail_query)) {
tep_mail($mail['customers_firstname'] . ' ' . $mail['customers_lastname'], $mail['customers_email_address'], $subject, $message, $from_name, $from, true);
};
tep_redirect(tep_href_link(FILENAME_MAIL, 'mail_sent_to=' . urlencode($mail_sent_to)));
Thanks JR