コード例 #1
0
ファイル: EmailManDelivery.php プロジェクト: NALSS/SuiteCRM
//default: save copies of the email.
if (isset($admin->settings['massemailer_email_copy'])) {
    $massemailer_email_copy = $admin->settings['massemailer_email_copy'];
}
$emailsPerSecond = 10;
$mail->setMailerForSystem();
$mail->From = "*****@*****.**";
$mail->FromName = "no-reply";
$mail->ContentType = "text/html";
$campaign_id = null;
if (isset($_REQUEST['campaign_id']) && !empty($_REQUEST['campaign_id'])) {
    $campaign_id = $_REQUEST['campaign_id'];
}
$db = DBManagerFactory::getInstance();
$timedate = TimeDate::getInstance();
$emailman = new EmailMan();
if ($test) {
    //if this is in test mode, then
    //find all the message that meet the following criteria.
    //1. scheduled send date time is now
    //2. campaign matches the current campaign
    //3. recipient belongs to a prospect list of type test, attached to this campaign
    $select_query = " SELECT em.* FROM emailman em";
    $select_query .= " join prospect_list_campaigns plc on em.campaign_id = plc.campaign_id";
    $select_query .= " join prospect_lists pl on pl.id = plc.prospect_list_id ";
    $select_query .= " WHERE em.list_id = pl.id and pl.list_type = 'test'";
    $select_query .= " AND em.send_date_time <= " . $db->now();
    $select_query .= " AND (em.in_queue ='0' OR em.in_queue IS NULL OR (em.in_queue ='1' AND em.in_queue_date <= " . $db->convert($db->quoted($timedate->fromString("-1 day")->asDb()), "datetime") . "))";
    $select_query .= " AND em.campaign_id='{$campaign_id}'";
    $select_query .= " ORDER BY em.send_date_time ASC, em.user_id, em.list_id";
} else {
コード例 #2
0
ファイル: Campaign.php プロジェクト: rgauss/sugarcrm_dev
 function get_queue_items()
 {
     //get arguments being passed in
     $args = func_get_args();
     $mkt_id = '';
     $this->load_relationship('queueitems');
     $query_array = $this->queueitems->getQuery(true);
     //if one of the arguments is marketing ID, then we need to filter by it
     foreach ($args as $arg) {
         if (isset($arg['EMAIL_MARKETING_ID_VALUE'])) {
             $mkt_id = $arg['EMAIL_MARKETING_ID_VALUE'];
         }
         if (isset($arg['group_by'])) {
             $query_array['group_by'] = $arg['group_by'];
         }
     }
     //add filtering by marketing id, if it exists, and if where key is not empty
     if (!empty($mkt_id) && !empty($query_array['where'])) {
         $query_array['where'] = $query_array['where'] . " AND marketing_id ='{$mkt_id}' ";
     }
     //get select query from email man
     $man = new EmailMan();
     $listquery = $man->create_queue_items_query('', str_replace(array("WHERE", "where"), "", $query_array['where']), null, $query_array);
     return $listquery;
 }
コード例 #3
0
ファイル: EmailQueue.php プロジェクト: sacredwebsite/SuiteCRM
        $prospect_id = $row['prospect_id'];
        $contact_id = $row['contact_id'];
        $lead_id = $row['lead_id'];
        if ($prospect_id != '') {
            $moduleName = "Prospects";
            $moduleID = $row['prospect_id'];
        }
        if ($contact_id != '') {
            $moduleName = "Contacts";
            $moduleID = $row['contact_id'];
        }
        if ($lead_id != '') {
            $moduleName = "Leads";
            $moduleID = $row['lead_id'];
        }
        $mailer = new EmailMan();
        $mailer->module = $moduleName;
        $mailer->module_id = $moduleID;
        $mailer->user_id = $current_user->id;
        $mailer->list_id = $prospect_list;
        $mailer->template_id = $template_id;
        $mailer->from_name = $fromName;
        $mailer->from_email = $fromEmail;
        $mailer->send_date_time = $dateval;
        $mailer->save();
    }
}
$header_URL = "Location: index.php?action=DetailView&module=Campaigns&record={$_REQUEST['record']}";
$GLOBALS['log']->debug("about to post header URL of: {$header_URL}");
if (preg_match('/\\s*Location:\\s*(.*)$/', $header_URL, $matches)) {
    $href = $matches[1];
コード例 #4
0
 function get_queue_items()
 {
     $this->load_relationship('queueitems');
     $query_array = $this->queueitems->getQuery(true);
     //get select query from email man.
     require_once 'modules/EmailMan/EmailMan.php';
     $man = new EmailMan();
     $listquery = $man->create_list_query('', str_replace(array("WHERE", "where"), "", $query_array['where']));
     return $listquery;
 }
コード例 #5
0
 public function testcreate_ref_email()
 {
     $emailMan = new EmailMan();
     $emailMan->test = true;
     $result = $emailMan->create_ref_email(0, 'test', 'test text', 'test html', 'test campaign', '*****@*****.**', '1', '', array(), true, 'test from address');
     //test for email id returned and mark delete for cleanup
     $this->assertEquals(36, strlen($result));
     $email = new Email();
     $email->mark_deleted($result);
 }
コード例 #6
0
        $mail->Password = $admin->settings['mail_smtppass'];
    }
    $mail->Mailer = "smtp";
    $mail->SMTPKeepAlive = true;
} else {
    $mail->mailer = 'sendmail';
}
$mail->From = "*****@*****.**";
$mail->FromName = "no-reply";
$mail->ContentType = "text/html";
$campaign_id = null;
if (isset($_REQUEST['campaign_id']) && !empty($_REQUEST['campaign_id'])) {
    $campaign_id = $_REQUEST['campaign_id'];
}
$db =& PearDatabase::getInstance();
$emailman = new EmailMan();
$select_query = " SELECT *";
$select_query .= " FROM {$emailman->table_name}";
$select_query .= " WHERE send_date_time <= " . db_convert("'" . gmdate('Y-m-d H:i:s') . "'", "datetime");
$select_query .= " AND (in_queue ='0' OR ( in_queue ='1' AND in_queue_date <= " . db_convert("'" . gmdate('Y-m-d H:i:s', strtotime("-1 day")) . "'", "datetime") . "))";
if (!empty($campaign_id)) {
    $select_query .= " AND campaign_id='{$campaign_id}'";
}
$select_query .= " ORDER BY campaign_id,user_id, list_id";
do {
    $no_items_in_queue = true;
    $result = $db->limitQuery($select_query, 0, $max_emails_per_run);
    global $current_user;
    if (isset($current_user)) {
        $temp_user = $current_user;
    }