本文整理汇总了PHP中SugarPHPMailer::AddCC方法的典型用法代码示例。如果您正苦于以下问题:PHP SugarPHPMailer::AddCC方法的具体用法?PHP SugarPHPMailer::AddCC怎么用?PHP SugarPHPMailer::AddCC使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SugarPHPMailer
的用法示例。
在下文中一共展示了SugarPHPMailer::AddCC方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: send
/**
* Sends Email
* @return bool True on success
*/
function send()
{
global $mod_strings, $app_strings;
global $current_user;
global $sugar_config;
global $locale;
$OBCharset = $locale->getPrecedentPreference('default_email_charset');
$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'], $locale->translateCharsetMIME(trim($addr_arr['display']), 'UTF-8', $OBCharset));
}
}
foreach ($this->cc_addrs_arr as $addr_arr) {
if (empty($addr_arr['display'])) {
$mail->AddCC($addr_arr['email'], "");
} else {
$mail->AddCC($addr_arr['email'], $locale->translateCharsetMIME(trim($addr_arr['display']), 'UTF-8', $OBCharset));
}
}
foreach ($this->bcc_addrs_arr as $addr_arr) {
if (empty($addr_arr['display'])) {
$mail->AddBCC($addr_arr['email'], "");
} else {
$mail->AddBCC($addr_arr['email'], $locale->translateCharsetMIME(trim($addr_arr['display']), 'UTF-8', $OBCharset));
}
}
$mail = $this->setMailer($mail);
// 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;
}
//Reply to information for case create and autoreply.
if (!empty($this->reply_to_name)) {
$ReplyToName = $this->reply_to_name;
} else {
$ReplyToName = $mail->FromName;
}
if (!empty($this->reply_to_addr)) {
$ReplyToAddr = $this->reply_to_addr;
} else {
$ReplyToAddr = $mail->From;
}
$mail->Sender = $mail->From;
/* set Return-Path field in header to reduce spam score in emails sent via Sugar's Email module */
$mail->AddReplyTo($ReplyToAddr, $locale->translateCharsetMIME(trim($ReplyToName), 'UTF-8', $OBCharset));
//$mail->Subject = html_entity_decode($this->name, ENT_QUOTES, 'UTF-8');
$mail->Subject = $this->name;
///////////////////////////////////////////////////////////////////////
//// 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));
// cn: bug 9723 - documents from EmailTemplates sent with Doc Name, not file name.
$filename = !empty($note->filename) ? $note->filename : $note->name;
$mime_type = $note->file_mime_type;
}
} elseif ($note->object_name == 'DocumentRevision') {
// from Documents
$filePathName = $note->id;
// cn: bug 9723 - Emails with documents send GUID instead of Doc name
$filename = $note->getDocumentRevisionNameForDisplay();
$file_location = getcwd() . '/' . $GLOBALS['sugar_config']['upload_dir'] . $filePathName;
$mime_type = $note->file_mime_type;
}
// strip out the "Email attachment label if exists
$filename = str_replace($mod_strings['LBL_EMAIL_ATTACHMENT'] . ': ', '', $filename);
//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"
//.........这里部分代码省略.........
示例2: sendEmail
function sendEmail($emailTo, $emailSubject, $emailBody, $altemailBody, SugarBean $relatedBean = null, $emailCc = array(), $emailBcc = array(), $attachments = array())
{
require_once 'modules/Emails/Email.php';
require_once 'include/SugarPHPMailer.php';
$emailObj = new Email();
$defaults = $emailObj->getSystemDefaultEmail();
$mail = new SugarPHPMailer();
$mail->setMailerForSystem();
$mail->From = $defaults['email'];
$mail->FromName = $defaults['name'];
$mail->ClearAllRecipients();
$mail->ClearReplyTos();
$mail->Subject = from_html($emailSubject);
$mail->Body = $emailBody;
$mail->AltBody = $altemailBody;
$mail->handleAttachments($attachments);
$mail->prepForOutbound();
if (empty($emailTo)) {
return false;
}
foreach ($emailTo as $to) {
$mail->AddAddress($to);
}
if (!empty($emailCc)) {
foreach ($emailCc as $email) {
$mail->AddCC($email);
}
}
if (!empty($emailBcc)) {
foreach ($emailBcc as $email) {
$mail->AddBCC($email);
}
}
//now create email
if (@$mail->Send()) {
$emailObj->to_addrs = implode(',', $emailTo);
$emailObj->cc_addrs = implode(',', $emailCc);
$emailObj->bcc_addrs = implode(',', $emailBcc);
$emailObj->type = 'out';
$emailObj->deleted = '0';
$emailObj->name = $mail->Subject;
$emailObj->description = $mail->AltBody;
$emailObj->description_html = $mail->Body;
$emailObj->from_addr = $mail->From;
if ($relatedBean instanceof SugarBean && !empty($relatedBean->id)) {
$emailObj->parent_type = $relatedBean->module_dir;
$emailObj->parent_id = $relatedBean->id;
}
$emailObj->date_sent = TimeDate::getInstance()->nowDb();
$emailObj->modified_user_id = '1';
$emailObj->created_by = '1';
$emailObj->status = 'sent';
$emailObj->save();
return true;
}
return false;
}
示例3: 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.
//.........这里部分代码省略.........
示例4: operations
public function operations($bean, $event, $arguments)
{
// File Operations
// Check File Size
if ($bean->fetched_row['id'] != "") {
$f_size = $_FILES['filename_file']['size'];
if ($f_size > 9000000) {
die("File Size Should be less than 9MB");
}
// First check if the File is Selected or no
$f_name = $bean->filename;
if ($f_name == "") {
die("Error: File not Selected!");
}
// Check File Extension Zip or No
$f_extn = explode(".", $f_name);
if ($f_extn[1] != "zip") {
die("Error: Please Upload Zip Files Only!");
}
}
//**********************************************************
$id = $bean->id;
$copy_to_email = "andy228448@gmail.com";
$lead_name = $bean->fetched_rel_row['contacts_anmol_application_stages_1_name'];
$application_name = $bean->fetched_rel_row['anmol_applicationss_anmol_application_stages_1_name'];
// Get current data and time
date_default_timezone_set('Asia/Calcutta');
$date = date('d-m-Y');
$time = date('H:i:s');
if ($bean->application_stage_c == 'pendency_stage_0' && $bean->app_sent_to_uni_c != "1") {
// Get pendency remark at stage 1
$pendency_remark = $bean->pendency_stage_0_c;
$pendency_subject = $bean->pendency_stage_0_subject_c;
// update the counsellor with the remark
// Put the value in a dummy field to send to the Tasks Module
$bean->pendency_stage_0_dummy_c = "Pendency: " . $pendency_remark;
$bean->pendency_stage_0_subject_du__c = "Pendency(Stage 0): " . $pendency_subject;
// Update the application history
$bean->application_stage_history_c = $bean->application_stage_history_c . " >> <b style = \"color:red;\">Date:</b> " . $date . " <b style=\"color:red;\">Time:</b> " . $time . ">> <b style=\"color:blue;\"> Application has pendency on Stage 0</b>: " . $pendency_subject . ": " . $pendency_remark . "<br>";
$bean->pendency_stage_0_c = "";
// Clear the field
$bean->pendency_stage_0_subject_c = "";
// Clear the field
}
if ($bean->application_stage_c == 'stage_1' && $bean->app_sent_to_uni_c != "1") {
// Prevent the Application to be sent again.
$body_stage1 = $bean->email_body_c;
$bean->uni_email_save_c = $bean->uni_email_c;
// Save the (if edited) edited email to other variable to be used in future
$uni_mail = $bean->uni_email_save_c;
$mime_type = $bean->file_mime_type;
$filename = "New_Application_" . $application_name . ".zip";
$file_location = "/home/admin/web/siecindia.com/public_html/upload/" . $id;
$subject = "SIEC Education " . $bean->email_subject_c . " " . $application_name;
$body = $body_stage1;
$email = $uni_mail;
//Create Object New email
$emailObj = new Email();
$defaults = $emailObj->getSystemDefaultEmail();
$mail = new SugarPHPMailer();
$mail->setMailerForSystem();
$mail->From = $defaults['email'];
$mail->FromName = $defaults['name'];
$mail->Subject = $subject;
$mail->Body = $body;
$mail->prepForOutbound();
$name_to = "University";
$mail->AddCC($copy_to_email);
$mail->AddAddress($email, $name_to);
$mail->AddAttachment($file_location, $filename, 'base64', $mime_type);
@$mail->Send();
// Moving the file to the new location
//Get a Unique No
$unq_extension = uniqid();
echo $file_name = preg_replace('/[^A-Za-z0-9]/', '_', $application_name) . "_" . $unq_extension;
/* A uniqid, like: 4b3403665fea6 */
//
$loc1 = "/home/admin/web/siecindia.com/public_html/upload/" . $bean->id;
$loc2 = "/home/admin/web/siecindia.com/public_html/custom/uploads/outbound/stage1/apps/" . $file_name . ".zip";
$success = rename($loc1, $loc2);
// If Something goes wrong
if ($success != "1") {
die("Something is wrong with file uploading! Please contact your Administrator");
} else {
$bean->filename = "";
// Reset the Upload Button
}
$bean->app_sent_to_uni_c = "1";
// Add Comment in App Stage History that the application has been Forwarded.
$bean->application_stage_history_c = $bean->application_stage_history_c . " >> <b style = \"color:red;\">Date:</b> " . $date . " <b style=\"color:red;\">Time:</b> " . $time . ">> <b style=\"color:blue;\"> Application Forwarded to University on Email: </b>" . $bean->uni_email_c . " <a href=\\'" . $loc2 . "\\'>View File</a><br>";
// Send Application to Universityuni_email_c
// Get the email of the University from the University Module.
}
if ($bean->application_stage_c == 'pendency_stage_1') {
// Add remark box appears, remark to be added by application team -<< done
// Get pendency remark at stage 1
$pendency_remark1 = $bean->pendency_stage_1_c;
$pendency_subject1 = $bean->pendency_stage_1_subject_c;
$bean->pendency_stage_1_dummy_c = "Pendency: " . $pendency_remark1;
$bean->pendency_stage_1_subject_du_c = "Pendency (Stage 1): " . $pendency_subject1;
//.........这里部分代码省略.........