当前位置: 首页>>代码示例>>PHP>>正文


PHP VTCacheUtils::getOutgoingMailFromEmailAddress方法代码示例

本文整理汇总了PHP中VTCacheUtils::getOutgoingMailFromEmailAddress方法的典型用法代码示例。如果您正苦于以下问题:PHP VTCacheUtils::getOutgoingMailFromEmailAddress方法的具体用法?PHP VTCacheUtils::getOutgoingMailFromEmailAddress怎么用?PHP VTCacheUtils::getOutgoingMailFromEmailAddress使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在VTCacheUtils的用法示例。


在下文中一共展示了VTCacheUtils::getOutgoingMailFromEmailAddress方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: send_mail

/**   Function used to send email
 *   $module 		-- current module
 *   $to_email 	-- to email address
 *   $from_name	-- currently loggedin user name
 *   $from_email	-- currently loggedin vtiger_users's email id. you can give as '' if you are not in HelpDesk module
 *   $subject		-- subject of the email you want to send
 *   $contents		-- body of the email you want to send
 *   $cc		-- add email ids with comma seperated. - optional
 *   $bcc		-- add email ids with comma seperated. - optional.
 *   $attachment	-- whether we want to attach the currently selected file or all vtiger_files.[values = current,all] - optional
 *   $emailid		-- id of the email object which will be used to get the vtiger_attachments
 */
function send_mail($module, $to_email, $from_name, $from_email, $subject, $contents, $cc = '', $bcc = '', $attachment = '', $emailid = '', $logo = '', $useGivenFromEmailAddress = false, $attachmentSrc = array())
{
    $adb = PearDatabase::getInstance();
    $log = vglobal('log');
    $root_directory = vglobal('root_directory');
    global $HELPDESK_SUPPORT_EMAIL_ID, $HELPDESK_SUPPORT_NAME;
    $uploaddir = $root_directory . "/cache/upload/";
    $adb->println("To id => '" . $to_email . "'\nSubject ==>'" . $subject . "'\nContents ==> '" . $contents . "'");
    //Get the email id of assigned_to user -- pass the value and name, name must be "user_name" or "id"(field names of vtiger_users vtiger_table)
    //$to_email = getUserEmailId('id',$assigned_user_id);
    //if module is HelpDesk then from_email will come based on support email id
    if ($from_email == '') {
        //if from email is not defined, then use the useremailid as the from address
        $from_email = getUserEmailId('user_name', $from_name);
    }
    //if the newly defined from email field is set, then use this email address as the from address
    //and use the username as the reply-to address
    $cachedFromEmail = VTCacheUtils::getOutgoingMailFromEmailAddress();
    if ($cachedFromEmail === null) {
        $query = "select from_email_field from vtiger_systems where server_type=?";
        $params = array('email');
        $result = $adb->pquery($query, $params);
        $from_email_field = $adb->query_result($result, 0, 'from_email_field');
        VTCacheUtils::setOutgoingMailFromEmailAddress($from_email_field);
    }
    if (isUserInitiated()) {
        $replyToEmail = $from_email;
    } else {
        $replyToEmail = $from_email_field;
    }
    if (isset($from_email_field) && $from_email_field != '' && !$useGivenFromEmailAddress) {
        //setting from _email to the defined email address in the outgoing server configuration
        $from_email = $from_email_field;
    }
    if ($module != "Calendar") {
        //$contents = addSignature($contents,$from_name); //TODO improved during the reconstruction Signature
        $mail = new PHPMailer();
    }
    setMailerProperties($mail, $subject, $contents, $from_email, $from_name, trim($to_email, ","), $attachment, $emailid, $module, $logo);
    setCCAddress($mail, 'cc', $cc);
    setCCAddress($mail, 'bcc', $bcc);
    if (!empty($replyToEmail)) {
        $mail->AddReplyTo($replyToEmail);
    }
    // vtmailscanner customization: If Support Reply to is defined use it.
    global $HELPDESK_SUPPORT_EMAIL_REPLY_ID;
    if ($HELPDESK_SUPPORT_EMAIL_REPLY_ID && $HELPDESK_SUPPORT_EMAIL_ID != $HELPDESK_SUPPORT_EMAIL_REPLY_ID) {
        $mail->AddReplyTo($HELPDESK_SUPPORT_EMAIL_REPLY_ID);
    }
    // END
    // Fix: Return immediately if Outgoing server not configured
    if (empty($mail->Host)) {
        return 0;
    }
    // END
    if (count($attachmentSrc)) {
        foreach ($attachmentSrc as $name => $src) {
            if (is_array($src)) {
                $mail->AddStringAttachment($src['string'], $src['filename'], $src['encoding'], $src['type']);
            } else {
                $mail->AddAttachment($src, $name);
            }
        }
    }
    $mail_status = MailSend($mail);
    if ($mail_status != 1) {
        $mail_error = getMailError($mail, $mail_status, $mailto);
    } else {
        $mail_error = $mail_status;
    }
    return $mail_error;
}
开发者ID:rcrrich,项目名称:UpdatePackages,代码行数:84,代码来源:mail.php

示例2: send_mail

/**   Function used to send email
 *   $module 		-- current module
 *   $to_email 	-- to email address
 *   $from_name	-- currently loggedin user name
 *   $from_email	-- currently loggedin vtiger_users's email id. you can give as '' if you are not in HelpDesk module
 *   $subject		-- subject of the email you want to send
 *   $contents		-- body of the email you want to send
 *   $cc		-- add email ids with comma seperated. - optional
 *   $bcc		-- add email ids with comma seperated. - optional.
 *   $attachment	-- whether we want to attach the currently selected file or all vtiger_files.[values = current,all] - optional
 *   $emailid		-- id of the email object which will be used to get the vtiger_attachments
 */
function send_mail($module, $to_email, $from_name, $from_email, $subject, $contents, $cc = '', $bcc = '', $attachment = '', $emailid = '', $logo = '', $useGivenFromEmailAddress = false)
{
    global $adb, $log;
    global $root_directory;
    global $HELPDESK_SUPPORT_EMAIL_ID, $HELPDESK_SUPPORT_NAME;
    $uploaddir = $root_directory . "/test/upload/";
    $adb->println("To id => '" . $to_email . "'\nSubject ==>'" . $subject . "'\nContents ==> '" . $contents . "'");
    //Get the email id of assigned_to user -- pass the value and name, name must be "user_name" or "id"(field names of vtiger_users vtiger_table)
    //$to_email = getUserEmailId('id',$assigned_user_id);
    //if module is HelpDesk then from_email will come based on support email id
    if ($from_email == '') {
        //if from email is not defined, then use the useremailid as the from address
        $from_email = getUserEmailId('user_name', $from_name);
    }
    //if the newly defined from email field is set, then use this email address as the from address
    //and use the username as the reply-to address
    $cachedFromEmail = VTCacheUtils::getOutgoingMailFromEmailAddress();
    if ($cachedFromEmail === null) {
        $query = "select from_email_field from vtiger_systems where server_type=?";
        $params = array('email');
        $result = $adb->pquery($query, $params);
        $from_email_field = $adb->query_result($result, 0, 'from_email_field');
        VTCacheUtils::setOutgoingMailFromEmailAddress($from_email_field);
    }
    if (isUserInitiated()) {
        $replyToEmail = $from_email;
    } else {
        $replyToEmail = $from_email_field;
    }
    if (isset($from_email_field) && $from_email_field != '' && !$useGivenFromEmailAddress) {
        //setting from _email to the defined email address in the outgoing server configuration
        $from_email = $from_email_field;
    }
    if ($module != "Calendar") {
        $contents = addSignature($contents, $from_name);
    }
    $mail = new PHPMailer();
    setMailerProperties($mail, $subject, $contents, $from_email, $from_name, trim($to_email, ","), $attachment, $emailid, $module, $logo);
    setCCAddress($mail, 'cc', $cc);
    setCCAddress($mail, 'bcc', $bcc);
    // SalesPlatform.ru begin
    // Duplicated AddReplyTo() call. First into the setMailerProperties()
    //if(!empty($replyToEmail)) {
    //	$mail->AddReplyTo($replyToEmail);
    //}
    // SalesPlatform.ru end
    // vtmailscanner customization: If Support Reply to is defined use it.
    global $HELPDESK_SUPPORT_EMAIL_REPLY_ID;
    if ($HELPDESK_SUPPORT_EMAIL_REPLY_ID && $HELPDESK_SUPPORT_EMAIL_ID != $HELPDESK_SUPPORT_EMAIL_REPLY_ID) {
        $mail->AddReplyTo($HELPDESK_SUPPORT_EMAIL_REPLY_ID);
    }
    // END
    // Fix: Return immediately if Outgoing server not configured
    if (empty($mail->Host)) {
        return 0;
    }
    // END
    $mail_status = MailSend($mail);
    if ($mail_status != 1) {
        $mail_error = getMailError($mail, $mail_status, $mailto);
    } else {
        $mail_error = $mail_status;
        // SalesPlatform.ru begin corrected date of sending
        $query = 'UPDATE vtiger_emaildetails SET email_flag ="SENT" WHERE emailid=?';
        $adb->pquery($query, array($emailid));
        // SalesPlatform.ru end
    }
    return $mail_error;
}
开发者ID:gitter-badger,项目名称:openshift-salesplatform,代码行数:81,代码来源:mail.php


注:本文中的VTCacheUtils::getOutgoingMailFromEmailAddress方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。