本文整理汇总了PHP中email::add_attachment方法的典型用法代码示例。如果您正苦于以下问题:PHP email::add_attachment方法的具体用法?PHP email::add_attachment怎么用?PHP email::add_attachment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类email
的用法示例。
在下文中一共展示了email::add_attachment方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tep_mail_no_triptag
function tep_mail_no_triptag($to_name, $to_email_address, $email_subject, $email_text, $from_email_name, $from_email_address, $htm = false, $attachment = '', $file_name = '', $header = '')
{
if (SEND_EMAILS != 'true') {
return false;
}
// Instantiate a new mail object
$message = new email(array('X-Mailer: osC mailer'));
// Build the text version
$message->add_html($email_text, '', DIR_FS_CATALOG . DIR_WS_IMAGES);
if (is_array($attachment)) {
foreach ($attachment as $add) {
// if(!empty($add)){
// if(strlen($add)>255){
$file_content = $add;
// }else{
// $file_content=$message->get_file($add);
// }
$message->add_attachment($file_content, $file_name);
// }
}
}
// Send message
$message->build_message();
$message->send($to_name, $to_email_address, $from_email_name, $from_email_address, $email_subject, $header, '-f' . STORE_OWNER_EMAIL_ADDRESS);
}
示例2: zen_mail
//.........这里部分代码省略.........
//define some additional html message blocks available to templates, then build the html portion.
if ($block['EMAIL_TO_NAME'] == '') {
$block['EMAIL_TO_NAME'] = $to_name;
}
if ($block['EMAIL_TO_ADDRESS'] == '') {
$block['EMAIL_TO_ADDRESS'] = $to_email_address;
}
if ($block['EMAIL_SUBJECT'] == '') {
$block['EMAIL_SUBJECT'] = $email_subject;
}
if ($block['EMAIL_FROM_NAME'] == '') {
$block['EMAIL_FROM_NAME'] = $from_email_name;
}
if ($block['EMAIL_FROM_ADDRESS'] == '') {
$block['EMAIL_FROM_ADDRESS'] = $from_email_address;
}
$email_html = zen_build_html_email_from_template($module, $block);
// if ($attachments_list == '') $attachments_list= array();
// Instantiate a new mail object
$message = new email(array('X-Mailer: Zen Cart Mailer'));
// bof: body of the email clean-up
// clean up & and && from email text
while (strstr($email_text, '&&')) {
$email_text = str_replace('&&', '&', $email_text);
}
while (strstr($email_text, '&')) {
$email_text = str_replace('&', '&', $email_text);
}
while (strstr($email_text, '&&')) {
$email_text = str_replace('&&', '&', $email_text);
}
// clean up money € to e
while (strstr($email_text, '€')) {
$email_text = str_replace('€', 'e', $email_text);
}
// fix double quotes
while (strstr($email_text, '"')) {
$email_text = str_replace('"', '"', $email_text);
}
// fix slashes
$email_text = stripslashes($email_text);
$email_html = stripslashes($email_html);
// eof: body of the email clean-up
//determine customer's email preference type: HTML or TEXT-ONLY (HTML assumed if not specified)
$customers_email_format_read = $db->Execute("select customers_email_format from " . TABLE_CUSTOMERS . " where customers_email_address= '" . $to_email_address . "'");
$customers_email_format = $customers_email_format_read->fields['customers_email_format'];
if ($customers_email_format == 'NONE' || $customers_email_format == 'OUT') {
return;
}
//if requested no mail, then don't send.
if ($customers_email_format == 'HTML') {
$customers_email_format = 'HTML';
}
// if they opted-in to HTML messages, then send HTML format
//determine what format to send messages in if this is an "extra"/admin-copy email:
if (ADMIN_EXTRA_EMAIL_FORMAT == 'TEXT' && substr($module, -6) == '_extra') {
$email_html = '';
// just blank out the html portion if admin has selected text-only
}
// Build the email based on whether customer has selected HTML or TEXT, and whether we have supplied HTML or TEXT-only components
if (!zen_not_null($email_text)) {
$text = str_replace('<br[[:space:]]*/?[[:space:]]*>', "@CRLF", $block['EMAIL_MESSAGE_HTML']);
$text = str_replace('</p>', '</p>@CRLF', $text);
$text = htmlspecialchars(stripslashes(strip_tags($text)));
} else {
$text = strip_tags($email_text);
}
if (EMAIL_USE_HTML == 'true' && trim($email_html) != '' && ($customers_email_format == 'HTML' || ADMIN_EXTRA_EMAIL_FORMAT != 'TEXT' && substr($module, -6) == '_extra')) {
$message->add_html($email_html, $text);
} else {
$message->add_text($text);
$email_html = '';
// since sending a text-only message, empty the HTML portion so it's not archived either.
}
// process attachments
if (EMAIL_ATTACHMENTS_ENABLED && zen_not_null($attachments_list)) {
// while ( list($key, $value) = each($attachments_list)) {
$fileraw = $message->get_file(DIR_FS_ADMIN . 'attachments/' . $attachments_list['file']);
$filemime = zen_not_null($attachments_list['file_type']) ? $attachments_list['file_type'] : $message->findMime($attachments_list);
//findMime determines what type this attachment is (XLS, PDF, etc) and sends proper vendor c_type.
$message->add_attachment($fileraw, $attachments_list['file'], $filemime);
// } //endwhile attach_list
}
//endif attachments
// Prepare message
$message->build_message();
// send the actual email
$result = $message->send($to_name, $to_email_address, $from_email_name, $from_email_address, $email_subject);
if (!$result) {
$messageStack->add(sprintf(EMAIL_SEND_FAILED, $to_name, $to_email_address, $email_subject), 'error');
}
// Archive this message to storage log
if (EMAIL_ARCHIVE == 'true' && $module != 'password_forgotten_admin' && $module != 'cc_middle_digs') {
// don't archive pwd-resets and CC numbers
zen_mail_archive_write($to_name, $to_email_address, $from_email_name, $from_email_address, $email_subject, $email_html, $text, $module);
}
// endif archiving
}
// end foreach loop thru possible multiple email addresses
}
示例3: email
}
}
$email_from = $g_db->prepare_input($_POST['email_from']);
$subject = $g_db->prepare_input($_POST['subject']);
$message = $g_db->prepare_input($_POST['message']);
//Let's build a message object using the email class
$mimemessage = new email(array('X-Mailer: Asymmetrics Mailer'));
if (EMAIL_USE_HTML == 'true') {
$text = strip_tags($message);
$mimemessage->add_html($message, $text);
} else {
$mimemessage->add_text($message);
}
if (isset($attach_array) && is_array($attach_array)) {
foreach ($attach_array as $value) {
$mimemessage->add_attachment($value['attachment'], $value['name'], $value['type']);
}
}
$mimemessage->build_message();
foreach ($mail_array as $mail) {
if (tep_not_null($mail['customers_firstname']) && tep_not_null($mail['customers_lastname'])) {
$name = $mail['customers_firstname'] . ' ' . $mail['customers_lastname'];
} else {
$name = $mail['customers_email_address'];
}
$mimemessage->send($name, $mail['customers_email_address'], '', $email_from, $subject);
}
$messageStack->add_session(sprintf(NOTICE_EMAIL_SENT_TO, $mail_sent_to), 'success');
tep_redirect(tep_href_link(basename($PHP_SELF)));
break;
case 'preview':