本文整理汇总了PHP中SugarPHPMailer::AddReplyTo方法的典型用法代码示例。如果您正苦于以下问题:PHP SugarPHPMailer::AddReplyTo方法的具体用法?PHP SugarPHPMailer::AddReplyTo怎么用?PHP SugarPHPMailer::AddReplyTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SugarPHPMailer
的用法示例。
在下文中一共展示了SugarPHPMailer::AddReplyTo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: send
function send()
{
global $mod_strings;
global $current_user;
global $sugar_config;
global $locale;
$mail = new SugarPHPMailer();
foreach ($this->to_addrs_arr as $addr_arr) {
if (empty($addr_arr['display'])) {
$mail->AddAddress($addr_arr['email'], "");
} else {
$mail->AddAddress($addr_arr['email'], $addr_arr['display']);
}
}
foreach ($this->cc_addrs_arr as $addr_arr) {
if (empty($addr_arr['display'])) {
$mail->AddCC($addr_arr['email'], "");
} else {
$mail->AddCC($addr_arr['email'], $addr_arr['display']);
}
}
foreach ($this->bcc_addrs_arr as $addr_arr) {
if (empty($addr_arr['display'])) {
$mail->AddBCC($addr_arr['email'], "");
} else {
$mail->AddBCC($addr_arr['email'], $addr_arr['display']);
}
}
if ($current_user->getPreference('mail_sendtype') == "SMTP") {
$mail->Mailer = "smtp";
$mail->Host = $current_user->getPreference('mail_smtpserver');
$mail->Port = $current_user->getPreference('mail_smtpport');
if ($current_user->getPreference('mail_smtpauth_req')) {
$mail->SMTPAuth = TRUE;
$mail->Username = $current_user->getPreference('mail_smtpuser');
$mail->Password = $current_user->getPreference('mail_smtppass');
}
} else {
// cn:no need to check since we default to it in any case!
$mail->Mailer = "sendmail";
}
// FROM ADDRESS
if (!empty($this->from_addr)) {
$mail->From = $this->from_addr;
} else {
$mail->From = $current_user->getPreference('mail_fromaddress');
$this->from_addr = $mail->From;
}
// FROM NAME
if (!empty($this->from_name)) {
$mail->FromName = $this->from_name;
} else {
$mail->FromName = $current_user->getPreference('mail_fromname');
$this->from_name = $mail->FromName;
}
$mail->Sender = $mail->From;
/* set Return-Path field in header to reduce spam score in emails sent via Sugar's Email module */
$mail->AddReplyTo($mail->From, $mail->FromName);
$encoding = version_compare(phpversion(), '5.0', '>=') ? 'UTF-8' : 'ISO-8859-1';
$mail->Subject = html_entity_decode($this->name, ENT_QUOTES, $encoding);
///////////////////////////////////////////////////////////////////////
//// ATTACHMENTS
foreach ($this->saved_attachments as $note) {
$mime_type = 'text/plain';
if ($note->object_name == 'Note') {
if (!empty($note->file->temp_file_location) && is_file($note->file->temp_file_location)) {
// brandy-new file upload/attachment
$file_location = $sugar_config['upload_dir'] . $note->id;
$filename = $note->file->original_file_name;
$mime_type = $note->file->mime_type;
} else {
// attachment coming from template/forward
$file_location = rawurldecode(UploadFile::get_file_path($note->filename, $note->id));
$filename = $note->name;
$mime_type = $note->file_mime_type;
}
} elseif ($note->object_name == 'DocumentRevision') {
// from Documents
$filename = $note->id;
$file_location = getcwd() . '/cache/upload/' . $filename;
$mime_type = $note->file_mime_type;
}
// strip out the "Email attachment label if exists
$filename = str_replace($mod_strings['LBL_EMAIL_ATTACHMENT'] . ': ', '', $filename);
// cn: bug 9233 attachment filenames need to be translated into the destination charset.
$filename = $locale->translateCharset($filename, 'UTF-8', $locale->getPrecedentPreference('default_email_charset'));
//is attachment in our list of bad files extensions? If so, append .txt to file location
//get position of last "." in file name
$file_ext_beg = strrpos($file_location, ".");
$file_ext = "";
//get file extension
if ($file_ext_beg > 0) {
$file_ext = substr($file_location, $file_ext_beg + 1);
}
//check to see if this is a file with extension located in "badext"
foreach ($sugar_config['upload_badext'] as $badExt) {
if (strtolower($file_ext) == strtolower($badExt)) {
//if found, then append with .txt to filename and break out of lookup
//this will make sure that the file goes out with right extension, but is stored
//as a text in db.
//.........这里部分代码省略.........
示例2: emails
function generate_email()
{
global $mod_strings;
global $current_user;
global $sugar_config;
global $locale;
require_once 'include/utils.php';
$query = 'SELECT name';
$query .= ' FROM emails';
$query .= " WHERE deleted=0";
$query .= " AND name='{$this->pnum}-Estimate'";
$result = $this->db->query($query, true, " Error filling in additional detail fields: ");
$n = $this->db->getRowCount($result);
if ($n == 0) {
$queryname = 'SELECT user_name';
$queryname .= ' FROM users';
$queryname .= " WHERE deleted=0";
$queryname .= " AND id='{$this->assigned_user_id}'";
$result_name = $this->db->query($queryname, true, " Error filling in additional detail fields: ");
$username = $this->db->fetchByAssoc($result_name);
$to_addrs_names = $username['user_name'];
$queryemail = 'SELECT email1';
$queryemail .= ' FROM users';
$queryemail .= " WHERE deleted=0";
$queryemail .= " AND id='{$this->assigned_user_id}'";
$result_email = $this->db->query($queryemail, true, " Error filling in additional detail fields: ");
$useremail = $this->db->fetchByAssoc($result_email);
$to_addrs_emails = $useremail['email1'];
$id = create_guid();
$from_addr = $current_user->name;
$from_name = $current_user->email1;
$name = $this->pnum . '-Estimate';
$description = $this->pnum . ' is waiting for estimate';
$query2 = "INSERT into emails (id, assigned_user_id, created_by, name, status, to_addrs_names, to_addrs_emails, from_addr, from_name, description, deleted, type, intent) ";
$query2 .= " VALUES ('{$id}', '{$this->assigned_user_id}', '{$current_user->id}', '{$name}', 'sent', '{$to_addrs_names}', '{$to_addrs_emails}', '{$from_addr}', '{$from_name}', '{$description}', '0', 'out', 'pick') ";
$this->db->query($query2, true, " Error filling in additional detail fields: ");
$mail = new SugarPHPMailer();
$mail->AddAddress($to_addrs_emails, $to_addrs_names);
$mail->Mailer = "sendmail";
// FROM ADDRESS
$mail->From = $from_addr;
// FROM NAME
$mail->FromName = $from_name;
$mail->Sender = $mail->From;
/* set Return-Path field in header to reduce spam score in emails sent via Sugar's Email module */
$mail->AddReplyTo($mail->From, $mail->FromName);
$encoding = version_compare(phpversion(), '5.0', '>=') ? 'UTF-8' : 'ISO-8859-1';
$mail->Subject = html_entity_decode($name, ENT_QUOTES, $encoding);
///////////////////////////////////////////////////////////////////////
//// HANDLE EMAIL FORMAT PREFERENCE
// the if() below is HIGHLY dependent on the Javascript unchecking the Send HTML Email box
// HTML email
// plain text only
$description_html = '';
$mail->IsHTML(false);
$mail->Body = wordwrap(from_html($description, 996));
// wp: if plain text version has lines greater than 998, use base64 encoding
foreach (explode("\n", $mail->ContentType == "text/html" ? $mail->AltBody : $mail->Body) as $line) {
if (strlen($line) > 998) {
$mail->Encoding = 'base64';
break;
}
}
//// HANDLE EMAIL FORMAT PREFERENCE
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
//// SAVE RAW MESSAGE
$mail->SetMessageType();
$raw = $mail->CreateHeader();
$raw .= $mail->CreateBody();
$raw_source = urlencode($raw);
//// END SAVE RAW MESSAGE
///////////////////////////////////////////////////////////////////////
$GLOBALS['log']->debug('Email sending --------------------- ');
///////////////////////////////////////////////////////////////////////
//// I18N TRANSLATION
$mail->prepForOutbound();
//// END I18N TRANSLATION
///////////////////////////////////////////////////////////////////////
$mail->Send();
}
}