本文整理汇总了PHP中EmailTemplate::setFrom方法的典型用法代码示例。如果您正苦于以下问题:PHP EmailTemplate::setFrom方法的具体用法?PHP EmailTemplate::setFrom怎么用?PHP EmailTemplate::setFrom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EmailTemplate
的用法示例。
在下文中一共展示了EmailTemplate::setFrom方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: eventSendEmailAlert
function eventSendEmailAlert(EventControler $event_controler)
{
if ($this->email_alert == 'y') {
$fields = $event_controler->fields;
$do_contact = $event_controler->do_contact;
$fields_content_html = '';
$fields_content_text = '';
foreach ($fields as $field_name => $field_value) {
if (strlen($field_value) > 0 && strlen($field_name) > 0) {
$fields_content_html .= '<br>' . $field_name . ': ' . $field_value;
$fields_content_text .= "\n" . $field_name . ": " . $field_value;
}
}
$email_values['fields_content_html'] = $fields_content_html;
$email_values['fields_content_text'] = $fields_content_text;
$email_values['firstname'] = $do_contact->firstname;
$email_values['webformname'] = $this->title;
$email_values['contact_url'] = $GLOBALS['cfg_ofuz_site_http_base'] . 'Contact/' . $do_contact->idcontact;
$email_template = new EmailTemplate("web form email alert");
$do_user = new User();
$do_user->getId($this->iduser);
$do_contact_email = $do_contact->getChildContactEmail();
$contact_email = $do_contact_email->getDefaultEmail();
if (strlen($contact_email) < 3) {
$contact_email = $GLOBALS['cfg_ofuz_email_support'];
}
$this->setLog("\n Sending webform alert to: " . $do_user->getFullName() . " with " . $do_user->email . " for new contact:" . $do_contact->firstname);
$email_template->setFrom($contact_email, $do_contact->firstname . " " . $do_contact->lastname);
$do_user->sendMessage($email_template, $email_values);
}
}
示例2: eventSendPortalAlert
/**
* eventSendPortalAlert
* This event is triggered when adding a note in a contact
* It will send a copy of the note the contact.
*/
function eventSendPortalAlert(EventControler $event_controler)
{
$this->setLog("eventSendPortalAlert starting (" . date("Y/m/d H:i:s") . ")");
$do_contact_email = $_SESSION['do_contact']->getChildContactEmail();
$email_to = $do_contact_email->getDefaultEmail();
$this->setLog("\nDocument in note: " . $_SESSION['ContactNoteEditSave']->document);
if (strlen($_SESSION['ContactNoteEditSave']->document) > 0) {
// If a file is attached
$doc_link = $GLOBALS['cfg_ofuz_site_http_base'] . 'files/' . $_SESSION['ContactNoteEditSave']->document;
$doc_name = $_SESSION['ContactNoteEditSave']->document;
$this->setLog("\n Document set to: " . $doc_name . " url:" . $doc_link);
} else {
$doc_name = '';
$doc_link = '';
}
$contact_link = $GLOBALS['cfg_ofuz_site_http_base'] . 'Contact/' . $_SESSION['do_contact']->idcontact;
$contact_name = $_SESSION['do_contact']->firstname . " " . $_SESSION['do_contact']->lastname;
$this->setLog("\nWe send a message from:" . $email_to);
if (strlen($email_to) > 4) {
$template = new EmailTemplate("ofuz portal alert");
$template->setFrom($email_to, $contact_name);
$content = array('note_html' => nl2br(htmlentities($_SESSION['ContactNoteEditSave']->note)), 'note_text' => $_SESSION['ContactNoteEditSave']->note, 'doc_name' => $doc_name, 'doc_link' => $doc_link, 'contact_link' => $contact_link, 'contact_name' => $contact_name);
$this->sendMessage($template, $content);
}
}