本文整理汇总了PHP中email::Attach方法的典型用法代码示例。如果您正苦于以下问题:PHP email::Attach方法的具体用法?PHP email::Attach怎么用?PHP email::Attach使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类email
的用法示例。
在下文中一共展示了email::Attach方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: email
exit;
}
// SET EMAIL ADDRESS TO SEND FORM RESULTS TO
$email_to = $ae_email;
//$email_to = 'stephen@stickyit.com';
if ($email_to == '') {
$email_to = 'benjaminjohnjamieson@gmail.com';
}
// SET THE "FROM" FIELD
//$email_from = '$_POST['work_email']';
$email_from = 'mobiletech@mobiletechilm.com';
// SET EMAIL SUBJECT LINE
$email_subject = "General Contact Message From Website";
// CONSTRUCT EMAIL BODY
$email_body = "This is an automatic message" . "\n" . "Someone has submit a message through your contact page.\n" . "\n" . "* * * * * * * * * * * * * * * * * * * * * * * *\n" . "\n";
// CREATE EMAIL BASED ON POST VALUES, EXCEPT FOR THE SPECIFIED FIELDS
foreach ($_POST as $key => $value) {
if ($key != 'country' && $key != 'time_stamp' && $key != 'max_file_size' && $key != 'submit_x' && $key != 'submit_y') {
$email_label = $key;
$email_label = str_replace('_', ' ', $email_label);
$email_body .= $email_label . ": " . $_POST[$key] . "\n\n";
}
}
$email_body .= "* * * * * * * * * * * * * * * * * * * * * * * *\n\n\n";
// SEND THE EMAIL TO FORM OWNER
$email = new email($email_from, $email_to, $email_subject, $email_body);
$email->Attach($_FILES[$fileField]);
$email->Send();
// REDIRECT USER TO SUCCESS PAGE
header("Location: ../form_results.php?result=success&type=bid");
exit;
示例2: sendMail
/**
* Send mail
*
* @param string $subject
* @param string $body
* @param string $fromEmail
* @param string $toEmail
* @param string $ccEmail
* @param string $bccEmail
* @param string $attachement
* @param string $bodyEncoding
* @param integer $priority
*/
function sendMail($subject, $body, $fromEmail, $toEmail, $ccEmail = null, $bccEmail = null, $attachement = null, $bodyEncoding = 'utf-8', $priority = 1)
{
$oMail = new email();
$oMail->From($fromEmail);
$oMail->To($toEmail);
if ($ccEmail) {
$oMail->Cc($ccEmail);
}
if ($bccEmail) {
$oMail->Bcc($bccEmail);
}
$oMail->Subject($subject);
$oMail->Body($body, $bodyEncoding, "text/html");
$oMail->Priority($priority);
if ($attachement) {
$oMail->Attach($attachement, "application/x-unknown-content-type", "attachment");
}
$oMail->Send();
}