This commit is contained in:
2024-04-27 09:23:34 +02:00
commit 11e713ca6f
11884 changed files with 3263371 additions and 0 deletions

63
modules/EmailMan/EmailImage.php Executable file
View File

@@ -0,0 +1,63 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM Community Edition is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
if(empty($_REQUEST['id']) || !preg_match("/^[\w\d\-]+$/", $_REQUEST['id'])) {
die("Not a Valid Entry Point");
}
require_once('modules/Notes/Note.php');
$note = new Note();
//check if file is an email image
if (!$note->retrieve_by_string_fields(array('id' => $_REQUEST['id'], 'parent_type' => "Emails"))) {
die("Not a Valid Entry Point");
}
$location = $GLOBALS['sugar_config']['upload_dir']."/" . $_REQUEST['id'];
$mime = getimagesize($location);
if(!empty($mime)) {
header("Content-Type: {$mime['mime']}");
} else {
header("Content-Type: image/png");
}
readfile($location);

994
modules/EmailMan/EmailMan.php Executable file
View File

@@ -0,0 +1,994 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
class EmailMan extends SugarBean{
var $id;
var $deleted;
var $date_created;
var $date_modified;
var $module;
var $module_id;
var $marketing_id;
var $campaign_id;
var $user_id;
var $list_id;
var $invalid_email;
var $from_name;
var $from_email;
var $in_queue;
var $in_queue_date;
var $template_id;
var $send_date_time;
var $table_name = "emailman";
var $object_name = "EmailMan";
var $module_dir = "EmailMan";
var $send_attempts;
var $related_id;
var $related_type;
var $test=false;
var $notes_array = array();
var $verified_email_marketing_ids = array();
function toString(){
return "EmailMan:\nid = $this->id ,user_id= $this->user_id module = $this->module , related_id = $this->related_id , related_type = $this->related_type ,list_id = $this->list_id, send_date_time= $this->send_date_time\n";
}
// This is used to retrieve related fields from form posts.
var $additional_column_fields = array();
function EmailMan() {
parent::SugarBean();
}
var $new_schema = true;
function create_new_list_query($order_by, $where,$filter=array(),$params=array(), $show_deleted = 0,$join_type='', $return_array = false,$parentbean=null, $singleSelect = false) {
$query = array('select' => '', 'from' => '', 'where' => '', 'order_by' => '');
if ( ( $this->db->dbType == 'mysql' ) or ( $this->db->dbType == 'oci8' ) )
{
$query['select'] = "SELECT $this->table_name.* ,
campaigns.name as campaign_name,
email_marketing.name as message_name,
(CASE related_type
WHEN 'Contacts' THEN CONCAT(CONCAT(contacts.first_name, '&nbsp;' ), contacts.last_name)
WHEN 'Leads' THEN CONCAT(CONCAT(leads.first_name, '&nbsp;' ), leads.last_name)
WHEN 'Accounts' THEN accounts.name
WHEN 'Users' THEN CONCAT(CONCAT(users.first_name, ' ' ), users.last_name)
WHEN 'Prospects' THEN CONCAT(CONCAT(prospects.first_name, '&nbsp;' ), prospects.last_name)
END) recipient_name";
}
if($this->db->dbType == 'mssql')
{
$query['select'] = "SELECT $this->table_name.* ,
campaigns.name as campaign_name,
email_marketing.name as message_name,
(CASE related_type
WHEN 'Contacts' THEN contacts.first_name + '&nbsp;' + contacts.last_name
WHEN 'Leads' THEN leads.first_name + '&nbsp;' + leads.last_name
WHEN 'Accounts' THEN accounts.name
WHEN 'Users' THEN users.first_name + ' ' + users.last_name
WHEN 'Prospects' THEN prospects.first_name + '&nbsp;' + prospects.last_name
END) recipient_name";
}
$query['from'] = " FROM $this->table_name
LEFT JOIN users ON users.id = $this->table_name.related_id and $this->table_name.related_type ='Users'
LEFT JOIN contacts ON contacts.id = $this->table_name.related_id and $this->table_name.related_type ='Contacts'
LEFT JOIN leads ON leads.id = $this->table_name.related_id and $this->table_name.related_type ='Leads'
LEFT JOIN accounts ON accounts.id = $this->table_name.related_id and $this->table_name.related_type ='Accounts'
LEFT JOIN prospects ON prospects.id = $this->table_name.related_id and $this->table_name.related_type ='Prospects'
LEFT JOIN prospect_lists ON prospect_lists.id = $this->table_name.list_id
LEFT JOIN email_addr_bean_rel ON email_addr_bean_rel.bean_id = $this->table_name.related_id and $this->table_name.related_type = email_addr_bean_rel.bean_module and email_addr_bean_rel.deleted=0
LEFT JOIN campaigns ON campaigns.id = $this->table_name.campaign_id
LEFT JOIN email_marketing ON email_marketing.id = $this->table_name.marketing_id ";
$where_auto = " $this->table_name.deleted=0";
if($where != "")
$query['where'] = "WHERE $where AND ".$where_auto;
else
$query['where'] = "WHERE ".$where_auto;
if(isset($params['group_by'])) {
$query['order_by'] .= " GROUP BY {$params['group_by']}";
}
if($order_by != ""){
$query['order_by'] = " ORDER BY $order_by";
}
if ($return_array) {
return $query;
}
return $query['select'] . $query['from'] . $query['where']. $query['order_by'];
} // if
function create_queue_items_query($order_by, $where,$filter=array(),$params=array(), $show_deleted = 0,$join_type='', $return_array = false,$parentbean=null, $singleSelect = false) {
if ($return_array) {
return parent::create_new_list_query($order_by, $where,$filter,$params, $show_deleted,$join_type, $return_array,$parentbean, $singleSelect);
}
if ( ( $this->db->dbType == 'mysql' ) or ( $this->db->dbType == 'oci8' ) )
{
$query = "SELECT $this->table_name.* ,
campaigns.name as campaign_name,
email_marketing.name as message_name,
(CASE related_type
WHEN 'Contacts' THEN CONCAT(CONCAT(contacts.first_name, '&nbsp;' ), contacts.last_name)
WHEN 'Leads' THEN CONCAT(CONCAT(leads.first_name, '&nbsp;' ), leads.last_name)
WHEN 'Accounts' THEN accounts.name
WHEN 'Users' THEN CONCAT(CONCAT(users.first_name, ' ' ), users.last_name)
WHEN 'Prospects' THEN CONCAT(CONCAT(prospects.first_name, '&nbsp;' ), prospects.last_name)
END) recipient_name";
}
if($this->db->dbType == 'mssql')
{
$query = "SELECT $this->table_name.* ,
campaigns.name as campaign_name,
email_marketing.name as message_name,
(CASE related_type
WHEN 'Contacts' THEN contacts.first_name + '&nbsp;' + contacts.last_name
WHEN 'Leads' THEN leads.first_name + '&nbsp;' + leads.last_name
WHEN 'Accounts' THEN accounts.name
WHEN 'Users' THEN users.first_name + ' ' + users.last_name
WHEN 'Prospects' THEN prospects.first_name + '&nbsp;' + prospects.last_name
END) recipient_name";
}
$query .= " FROM $this->table_name
LEFT JOIN users ON users.id = $this->table_name.related_id and $this->table_name.related_type ='Users'
LEFT JOIN contacts ON contacts.id = $this->table_name.related_id and $this->table_name.related_type ='Contacts'
LEFT JOIN leads ON leads.id = $this->table_name.related_id and $this->table_name.related_type ='Leads'
LEFT JOIN accounts ON accounts.id = $this->table_name.related_id and $this->table_name.related_type ='Accounts'
LEFT JOIN prospects ON prospects.id = $this->table_name.related_id and $this->table_name.related_type ='Prospects'
LEFT JOIN prospect_lists ON prospect_lists.id = $this->table_name.list_id
LEFT JOIN email_addr_bean_rel ON email_addr_bean_rel.bean_id = $this->table_name.related_id and $this->table_name.related_type = email_addr_bean_rel.bean_module and email_addr_bean_rel.deleted=0
LEFT JOIN campaigns ON campaigns.id = $this->table_name.campaign_id
LEFT JOIN email_marketing ON email_marketing.id = $this->table_name.marketing_id ";
//B.F. #37943
if( isset($params['group_by']) )
{
$group_by = str_replace("emailman", "em", $params['group_by']);
$query .= "INNER JOIN (select min(id) as id from emailman em GROUP BY $group_by ) secondary
on {$this->table_name}.id = secondary.id ";
}
$where_auto = " $this->table_name.deleted=0";
if($where != "")
$query .= "WHERE $where AND ".$where_auto;
else
$query .= "WHERE ".$where_auto;
if($order_by != "")
$query .= " ORDER BY $order_by";
return $query;
}
function create_list_query($order_by, $where, $show_deleted = 0){
if ( ( $this->db->dbType == 'mysql' ) or ( $this->db->dbType == 'oci8' ) )
{
$query = "SELECT $this->table_name.* ,
campaigns.name as campaign_name,
email_marketing.name as message_name,
(CASE related_type
WHEN 'Contacts' THEN CONCAT(CONCAT(contacts.first_name, '&nbsp;' ), contacts.last_name)
WHEN 'Leads' THEN CONCAT(CONCAT(leads.first_name, '&nbsp;' ), leads.last_name)
WHEN 'Accounts' THEN accounts.name
WHEN 'Users' THEN CONCAT(CONCAT(users.first_name, ' ' ), users.last_name)
WHEN 'Prospects' THEN CONCAT(CONCAT(prospects.first_name, '&nbsp;' ), prospects.last_name)
END) recipient_name";
}
if($this->db->dbType == 'mssql')
{
$query = "SELECT $this->table_name.* ,
campaigns.name as campaign_name,
email_marketing.name as message_name,
(CASE related_type
WHEN 'Contacts' THEN contacts.first_name + '&nbsp;' + contacts.last_name
WHEN 'Leads' THEN leads.first_name + '&nbsp;' + leads.last_name
WHEN 'Accounts' THEN accounts.name
WHEN 'Users' THEN users.first_name + ' ' + users.last_name
WHEN 'Prospects' THEN prospects.first_name + '&nbsp;' + prospects.last_name
END) recipient_name";
}
$query .= " FROM $this->table_name
LEFT JOIN users ON users.id = $this->table_name.related_id and $this->table_name.related_type ='Users'
LEFT JOIN contacts ON contacts.id = $this->table_name.related_id and $this->table_name.related_type ='Contacts'
LEFT JOIN leads ON leads.id = $this->table_name.related_id and $this->table_name.related_type ='Leads'
LEFT JOIN accounts ON accounts.id = $this->table_name.related_id and $this->table_name.related_type ='Accounts'
LEFT JOIN prospects ON prospects.id = $this->table_name.related_id and $this->table_name.related_type ='Prospects'
LEFT JOIN prospect_lists ON prospect_lists.id = $this->table_name.list_id
LEFT JOIN email_addr_bean_rel ON email_addr_bean_rel.bean_id = $this->table_name.related_id and $this->table_name.related_type = email_addr_bean_rel.bean_module and email_addr_bean_rel.deleted=0
LEFT JOIN campaigns ON campaigns.id = $this->table_name.campaign_id
LEFT JOIN email_marketing ON email_marketing.id = $this->table_name.marketing_id ";
$where_auto = " $this->table_name.deleted=0";
if($where != "")
$query .= "where $where AND ".$where_auto;
else
$query .= "where ".$where_auto;
if($order_by != ""){
$query .= " ORDER BY $order_by";
}
return $query;
}
function get_list_view_data()
{ global $locale, $current_user;
$temp_array = parent::get_list_view_array();
$query="select first_name, last_name from ". strtolower($temp_array['RELATED_TYPE']) ." where id ='".$temp_array['RELATED_ID']."'";
$result=$this->db->query($query);
$row=$this->db->fetchByAssoc($result);
if ($row) {
$full_name = $locale->getLocaleFormattedName($row['first_name'], $row['last_name'], '');
$temp_array['RECIPIENT_NAME']=$full_name;
}
//also store the recipient_email address
$query = "select addr.email_address from email_addresses addr,email_addr_bean_rel eb where eb.deleted=0 and addr.id=eb.email_address_id and bean_id ='". $temp_array['RELATED_ID']."' and primary_address = '1'";
$result=$this->db->query($query);
$row=$this->db->fetchByAssoc($result);
if ($row) {
$temp_array['RECIPIENT_EMAIL']=$row['email_address'];
}
$this->email1 = $temp_array['RECIPIENT_EMAIL'];
$temp_array['EMAIL1_LINK'] = $current_user->getEmailLink('email1', $this, '', '', 'ListView');
return $temp_array;
}
function set_as_sent($email_address, $delete= true,$email_id=null, $email_type=null,$activity_type=null){
global $timedate;
$this->send_attempts++;
if($delete || $this->send_attempts > 5){
//create new campaign log record.
$campaign_log = new CampaignLog();
$campaign_log->campaign_id=$this->campaign_id;
$campaign_log->target_tracker_key=$this->target_tracker_key;
$campaign_log->target_id= $this->related_id;
$campaign_log->target_type=$this->related_type;
$campaign_log->marketing_id=$this->marketing_id;
//if test suppress duplicate email address checking.
if (!$this->test) {
$campaign_log->more_information=$email_address;
}
$campaign_log->activity_type=$activity_type;
$campaign_log->activity_date=$timedate->to_display_date_time(gmdate($GLOBALS['timedate']->get_db_date_time_format()));
$campaign_log->list_id=$this->list_id;
$campaign_log->related_id= $email_id;
$campaign_log->related_type=$email_type;
$campaign_log->save();
$query = "DELETE FROM emailman WHERE id = $this->id";
$this->db->query($query);
}else{
//try to send the email again a day later.
$query = 'UPDATE ' . $this->table_name . " SET in_queue='1', send_attempts='$this->send_attempts', in_queue_date='". gmdate($GLOBALS['timedate']->get_db_date_time_format()) ."' WHERE id = '$this->id'";
$this->db->query($query);
}
}
/**
* Function finds the reference email for the campaign. Since a campaign can have multiple email templates
* the reference email has same id as the marketing id.
* this function will create an email if one does not exist. also the function will load these relationships leads, accounts, contacts
* users and targets
*
* @param varchar marketing_id message id
* @param string $subject email subject
* @param string $body_text Email Body Text
* @param string $body_html Email Body HTML
* @param string $campaign_name Campaign Name
* @param string from_address Email address of the sender, usually email address of the configured inbox.
* @param string sender_id If of the user sending the campaign.
* @param array macro_nv array of name value pair, one row for each replacable macro in email template text.
* @return
*/
function create_ref_email($marketing_id,$subject,$body_text,$body_html,$campagin_name,$from_address,$sender_id,$notes,$macro_nv,$newmessage) {
global $mod_Strings;
$upd_ref_email=false;
if ($newmessage or empty($this->ref_email->id)) {
$this->ref_email = new Email();
$this->ref_email->retrieve($marketing_id, true, false);
//the reference email should be updated when user swithces from test mode to regular mode,and, for every run in test mode, and is user
//switches back to test mode.
//this is to account for changes to email template.
$upd_ref_email=(!empty($this->ref_email->id) and $this->ref_email->parent_type=='test' and $this->ref_email->parent_id=='test');
//following condition is for switching back to test mode.
if (!$upd_ref_email) $upd_ref_email=($this->test and !empty($this->ref_email->id) and empty($this->ref_email->parent_type) and empty($this->ref_email->parent_id));
if (empty($this->ref_email->id) or $upd_ref_email) {
//create email record.
$this->ref_email->id=$marketing_id;
$this->ref_email->date_sent = '';
if ($upd_ref_email==false) {
$this->ref_email->new_with_id=true;
}
$this->ref_email->to_addrs= '';
$this->ref_email->to_addrs_ids = '';
$this->ref_email->to_addrs_names = '';
$this->ref_email->to_addrs_emails ='';
$this->ref_email->type= 'campaign';
$this->ref_email->deleted = '0';
$this->ref_email->name = $campagin_name.': '.$subject ;
$this->ref_email->description_html = $body_html;
$this->ref_email->description = $body_text;
$this->ref_email->from_addr = $from_address;
$this->ref_email->assigned_user_id = $sender_id;
if ($this->test) {
$this->ref_email->parent_type = 'test';
$this->ref_email->parent_id = 'test';
} else {
$this->ref_email->parent_type = '';
$this->ref_email->parent_id = '';
}
$this->ref_email->date_start =$GLOBALS['timedate']->to_display_date(gmdate($GLOBALS['timedate']->dbDayFormat));
$this->ref_email->time_start =$GLOBALS['timedate']->to_display_time(gmdate($GLOBALS['timedate']->dbTimeFormat));
$this->ref_email->status='sent';
$retId = $this->ref_email->save();
if (count($notes) > 0 ) {
if (!class_exists('Note'))
if (!class_exists('UploadFile')) require_once('include/upload_file.php');
}
foreach($notes as $note) {
if($note->object_name == 'Note') {
if (! empty($note->file->temp_file_location) && is_file($note->file->temp_file_location)) {
$file_location = $note->file->temp_file_location;
$filename = $note->file->original_file_name;
$mime_type = $note->file->mime_type;
} else {
$file_location = rawurldecode(UploadFile::get_file_path($note->filename,$note->id));
$filename = $note->id.$note->filename;
$mime_type = $note->file_mime_type;
}
} elseif($note->object_name == 'DocumentRevision') { // from Documents
$filename = $note->id.$note->filename;
$file_location = getcwd().'/'.$GLOBALS['sugar_config']['upload_dir'].$filename;
$mime_type = $note->file_mime_type;
}
$noteAudit = new Note();
$noteAudit->parent_id = $retId;
$noteAudit->parent_type = $this->ref_email->module_dir;
$noteAudit->description = "[".$note->filename."] ".$mod_strings['LBL_ATTACHMENT_AUDIT'];
$noteAudit->filename=$filename;
$noteAudit->file_mime_type=$mime_type;
$noteAudit_id=$noteAudit->save();
UploadFile::duplicate_file($note->id, $noteAudit_id, $filename);
}
}
//load relationships.
$this->ref_email->load_relationship('users');
$this->ref_email->load_relationship('prospects');
$this->ref_email->load_relationship('contacts');
$this->ref_email->load_relationship('leads');
$this->ref_email->load_relationship('accounts');
}
if (!empty($this->related_id ) && !empty($this->related_type)) {
//save relationships.
switch ($this->related_type) {
case 'Users':
$rel_name="users";
break;
case 'Prospects':
$rel_name="prospects";
break;
case 'Contacts':
$rel_name="contacts";
break;
case 'Leads':
$rel_name="leads";
break;
case 'Accounts':
$rel_name="accounts";
break;
}
//required for one email per campaign per marketing message.
$this->ref_email->$rel_name->add($this->related_id,array('campaign_data'=>serialize($macro_nv)));
}
return $this->ref_email->id;
}
/**
* The function creates a copy of email send to each target.
*/
function create_indiv_email($module,$mail) {
global $locale;
$email = new Email();
$email->to_addrs= $locale->getLocaleFormattedName($module->first_name, $module->last_name) . '&lt;'.$module->email1.'&gt;';
$email->to_addrs_ids = $module->id .';';
$email->to_addrs_names = $locale->getLocaleFormattedName($module->first_name, $module->last_name) . ';';
$email->to_addrs_emails = $module->email1 . ';';
$email->type= 'archived';
$email->deleted = '0';
$email->name = $this->current_campaign->name.': '.$mail->Subject ;
if ($mail->ContentType == "text/plain") {
$email->description = $mail->Body;
$email->description_html =null;
} else {
$email->description_html = $mail->Body;
$email->description = $mail->AltBody;
}
$email->from_addr = $mail->From;
$email->assigned_user_id = $this->user_id;
$email->parent_type = $this->related_type;
$email->parent_id = $this->related_id ;
$email->date_start =date($GLOBALS['timedate']->dbDayFormat);
$email->time_start =date($GLOBALS['timedate']->dbTimeFormat);
$email->status='sent';
$retId = $email->save();
foreach($this->notes_array as $note) {
if(!class_exists('Note')) {
}
// create "audit" email without duping off the file to save on disk space
$noteAudit = new Note();
$noteAudit->parent_id = $retId;
$noteAudit->parent_type = $email->module_dir;
$noteAudit->description = "[".$note->filename."] ".$mod_strings['LBL_ATTACHMENT_AUDIT'];
$noteAudit->save();
}
if (!empty($this->related_id ) && !empty($this->related_type)) {
//save relationships.
switch ($this->related_type) {
case 'Users':
$rel_name="users";
break;
case 'Prospects':
$rel_name="prospects";
break;
case 'Contacts':
$rel_name="contacts";
break;
case 'Leads':
$rel_name="leads";
break;
case 'Accounts':
$rel_name="accounts";
break;
}
if (!empty($rel_name)) {
$email->load_relationship($rel_name);
$email->$rel_name->add($this->related_id);
}
}
return $email->id;
}
/*
* Call this function to verify the email_marketing message and email_template configured
* for the campaign. If issues are found a fatal error will be logged but processing will not stop.
* @return Boolean Returns true if all campaign parameters are set correctly
*/
function verify_campaign($marketing_id) {
if (!isset($this->verified_email_marketing_ids[$marketing_id])) {
if (!class_exists('EmailMarketing')) {
}
$email_marketing = new EmailMarketing();
$ret=$email_marketing->retrieve($marketing_id);
if (empty($ret)) {
$GLOBALS['log']->fatal('Error retrieving marketing message for the email campaign. marketing_id = ' .$marketing_id);
return false;
}
//verify the email template.
if (empty($email_marketing->template_id)) {
$GLOBALS['log']->fatal('Error retrieving template for the email campaign. marketing_id = ' .$marketing_id);
return false;
}
if (!class_exists('EmailTemplate')) {
}
$emailtemplate= new EmailTemplate();
$ret=$emailtemplate->retrieve($email_marketing->template_id);
if (empty($ret)) {
$GLOBALS['log']->fatal('Error retrieving template for the email campaign. template_id = ' .$email_marketing->template_id);
return false;
}
if (empty($emailtemplate->subject) and empty($emailtemplate->body) and empty($emailtemplate->body_html)) {
$GLOBALS['log']->fatal('Email template is empty. email_template_id=' .$email_marketing->template_id);
return false;
}
}
$this->verified_email_marketing_ids[$marketing_id]=1;
return true;
}
function sendEmail($mail,$save_emails=1,$testmode=false){
$this->test=$testmode;
global $beanList, $beanFiles, $sugar_config;
global $mod_strings;
global $locale;
$OBCharset = $locale->getPrecedentPreference('default_email_charset');
$mod_strings = return_module_language( $sugar_config['default_language'], 'EmailMan');
//get tracking entities locations.
if (!isset($this->tracking_url)) {
if (!class_exists('Administration')) {
}
$admin=new Administration();
$admin->retrieveSettings('massemailer'); //retrieve all admin settings.
if (isset($admin->settings['massemailer_tracking_entities_location_type']) and $admin->settings['massemailer_tracking_entities_location_type']=='2' and isset($admin->settings['massemailer_tracking_entities_location']) ) {
$this->tracking_url=$admin->settings['massemailer_tracking_entities_location'];
} else {
$this->tracking_url=$sugar_config['site_url'];
}
}
//make sure tracking url ends with '/' character
$strLen = strlen($this->tracking_url);
if($this->tracking_url{$strLen-1} !='/'){
$this->tracking_url .='/';
}
if(!isset($beanList[$this->related_type])){
return false;
}
$class = $beanList[$this->related_type];
if (!class_exists($class)) {
require_once($beanFiles[$class]);
}
if (!class_exists('Email')) {
}
$module = new $class();
$module->retrieve($this->related_id);
$module->emailAddress->handleLegacyRetrieve($module);
//check to see if bean has a primary email address
if (!$this->is_primary_email_address($module)) {
//no primary email address designated, do not send out email, create campaign log
//of type send error to denote that this user was not emailed
$this->set_as_sent($module->email1, true,null,null,'send error');
//create fatal logging for easy review of cause.
$GLOBALS['log']->fatal('Email Address provided is not Primary Address for email with id ' . $module->email1 . "' Emailman id=$this->id");
return true;
}
if (!$this->valid_email_address($module->email1)) {
$this->set_as_sent($module->email1, true,null,null,'invalid email');
$GLOBALS['log']->fatal('Encountered invalid email address' . $module->email1 . " Emailman id=$this->id");
return true;
}
if ((!isset($module->email_opt_out)
|| ($module->email_opt_out !== 'on'
&& $module->email_opt_out !== 1
&& $module->email_opt_out !== '1'))
&& (!isset($module->invalid_email)
|| ($module->invalid_email !== 'on'
&& $module->invalid_email !== 1
&& $module->invalid_email !== '1'))){
$lower_email_address=strtolower($module->email1);
//test against indivdual address.
if (isset($this->restricted_addresses) and isset($this->restricted_addresses[$lower_email_address])) {
$this->set_as_sent($lower_email_address, true,null,null,'blocked');
return true;
}
//test against restricted domains
$at_pos=strrpos($lower_email_address,'@');
if ($at_pos !== false) {
foreach ($this->restricted_domains as $domain=>$value) {
$pos=strrpos($lower_email_address,$domain);
if ($pos !== false && $pos > $at_pos) {
//found
$this->set_as_sent($lower_email_address, true,null,null,'blocked');
return true;
}
}
}
//test for duplicate email address by marketing id.
$dup_query="select id from campaign_log where more_information='".$module->email1."' and marketing_id='".$this->marketing_id."'";
$dup=$this->db->query($dup_query);
$dup_row=$this->db->fetchByAssoc($dup);
if (!empty($dup_row)) {
//we have seen this email address before
$this->set_as_sent($module->email1,true,null,null,'blocked');
return true;
}
$this->target_tracker_key=create_guid();
//fetch email marketing.
if (empty($this->current_emailmarketing) or !isset($this->current_emailmarketing)) {
if (!class_exists('EmailMarketing')) {
}
$this->current_emailmarketing=new EmailMarketing();
}
if (empty($this->current_emailmarketing->id) or $this->current_emailmarketing->id !== $this->marketing_id) {
$this->current_emailmarketing->retrieve($this->marketing_id);
$this->newmessage = true;
}
//fetch email template associate with the marketing message.
if (empty($this->current_emailtemplate) or $this->current_emailtemplate->id !== $this->current_emailmarketing->template_id) {
if (!class_exists('EmailTemplate')) {
}
$this->current_emailtemplate= new EmailTemplate();
$this->current_emailtemplate->retrieve($this->current_emailmarketing->template_id);
//escape email template contents.
$this->current_emailtemplate->subject=from_html($this->current_emailtemplate->subject);
$this->current_emailtemplate->body_html=from_html($this->current_emailtemplate->body_html);
$this->current_emailtemplate->body=from_html($this->current_emailtemplate->body);
$q = "SELECT * FROM notes WHERE parent_id = '".$this->current_emailtemplate->id."' AND deleted = 0";
$r = $this->db->query($q);
// cn: bug 4684 - initialize the notes array, else old data is still around for the next round
$this->notes_array = array();
if (!class_exists('Note')){
require_once('modules/Notes/Note.php');
}
while($a = $this->db->fetchByAssoc($r)) {
$noteTemplate = new Note();
$noteTemplate->retrieve($a['id']);
$this->notes_array[] = $noteTemplate;
}
}
// fetch mailbox details..
if(empty($this->current_mailbox)) {
if (!class_exists('InboundEmail')) {
}
$this->current_mailbox= new InboundEmail();
}
if (empty($this->current_mailbox->id) or $this->current_mailbox->id !== $this->current_emailmarketing->inbound_email_id) {
$this->current_mailbox->retrieve($this->current_emailmarketing->inbound_email_id);
//extract the email address.
$this->mailbox_from_addr=$this->current_mailbox->get_stored_options('from_addr','nobody@example.com',null);
}
// fetch campaign details..
if (empty($this->current_campaign)) {
if (!class_exists('Campaign')) {
}
$this->current_campaign= new Campaign();
}
if (empty($this->current_campaign->id) or $this->current_campaign->id !== $this->current_emailmarketing->campaign_id) {
$this->current_campaign->retrieve($this->current_emailmarketing->campaign_id);
//load defined tracked_urls
$this->current_campaign->load_relationship('tracked_urls');
$query_array=$this->current_campaign->tracked_urls->getQuery(true);
$query_array['select']="SELECT tracker_name, tracker_key, id, is_optout ";
$result=$this->current_campaign->db->query(implode(' ',$query_array));
$this->has_optout_links=false;
$this->tracker_urls=array();
while (($row=$this->current_campaign->db->fetchByAssoc($result)) != null) {
$this->tracker_urls['{'.$row['tracker_name'].'}']=$row;
//has the user defined opt-out links for the campaign.
if ($row['is_optout']==1) {
$this->has_optout_links=true;
}
}
}
$mail->ClearAllRecipients();
$mail->ClearReplyTos();
$mail->Sender = $this->mailbox_from_addr;
$mail->From = $this->mailbox_from_addr;
$mail->FromName = $this->current_emailmarketing->from_name;
//CL - Bug 25256 Check if we have a reply_to_name/reply_to_addr value from the email marketing table. If so use email marketing entry; otherwise current mailbox (inbound email) entry
$replyToName = empty($this->current_emailmarketing->reply_to_name) ? $this->current_mailbox->get_stored_options('reply_to_name',$mail->FromName,null) : $this->current_emailmarketing->reply_to_name;
$replyToAddr = empty($this->current_emailmarketing->reply_to_addr) ? $this->current_mailbox->get_stored_options('reply_to_addr',$mail->From,null) : $this->current_emailmarketing->reply_to_addr;
$mail->AddReplyTo($replyToAddr,$locale->translateCharsetMIME(trim($replyToName), 'UTF-8', $OBCharset));
//parse and replace bean variables.
$macro_nv=array();
$template_data= $this->current_emailtemplate->parse_email_template(array('subject'=>$this->current_emailtemplate->subject,
'body_html'=>$this->current_emailtemplate->body_html,
'body'=>$this->current_emailtemplate->body,
)
,'Contacts', $module
,$macro_nv);
//add email address to this list.
$macro_nv['sugar_to_email_address']=$module->email1;
$macro_nv['email_template_id']=$this->current_emailmarketing->template_id;
//parse and replace urls.
//this is new style of adding tracked urls to a campaign.
$tracker_url_template= $this->tracking_url . 'index.php?entryPoint=campaign_trackerv2&track=%s'.'&identifier='.$this->target_tracker_key;
$removeme_url_template=$this->tracking_url . 'index.php?entryPoint=removeme&identifier='.$this->target_tracker_key;
$template_data= $this->current_emailtemplate->parse_tracker_urls($template_data,$tracker_url_template,$this->tracker_urls,$removeme_url_template);
$mail->AddAddress($module->email1,$locale->translateCharsetMIME(trim($locale->getLocaleFormattedName($module->first_name, $module->last_name)), 'UTF-8', $OBCharset) );
//refetch strings in case they have been changed by creation of email templates or other beans.
$mod_strings = return_module_language( $sugar_config['default_language'], 'EmailMan');
if($this->test){
$mail->Subject = $mod_strings['LBL_PREPEND_TEST'] . $template_data['subject'];
}else{
$mail->Subject = $template_data['subject'];
}
//check if this template is meant to be used as "text only"
$text_only = false;
if(isset($this->current_emailtemplate->text_only) && $this->current_emailtemplate->text_only){$text_only =true;}
//if this template is textonly, then just send text body. Do not add tracker, opt out,
//or perform other processing as it will not show up in text only email
if($text_only){
$this->description_html = '';
$mail->IsHTML(false);
$mail->Body = $template_data['body'];
}else{
$mail->Body = wordwrap($template_data['body_html'], 900);
//BEGIN:this code will trigger for only campaigns pending before upgrade to 4.2.0.
//will be removed for the next release.
if(!isset($btracker)) $btracker=false;
if ($btracker) {
$mail->Body .= "<br><br><a href='". $tracker_url ."'>" . $tracker_text . "</a><br><br>";
} else {
if (!empty($tracker_url)) {
$mail->Body = str_replace('TRACKER_URL_START', "<a href='" . $tracker_url ."'>", $mail->Body);
$mail->Body = str_replace('TRACKER_URL_END', "</a>", $mail->Body);
$mail->AltBody = str_replace('TRACKER_URL_START', "<a href='" . $tracker_url ."'>", $mail->AltBody);
$mail->AltBody = str_replace('TRACKER_URL_END', "</a>", $mail->AltBody);
}
}
//END
//do not add the default remove me link if the campaign has a trackerurl of the opotout link
if ($this->has_optout_links==false) {
$mail->Body .= "<br><font size='2'>{$mod_strings['TXT_REMOVE_ME']}<a href='". $this->tracking_url . "index.php?entryPoint=removeme&identifier={$this->target_tracker_key}'>{$mod_strings['TXT_REMOVE_ME_CLICK']}</a></font>";
}
// cn: bug 11979 - adding single quote to comform with HTML email RFC
$mail->Body .= "<br><IMG HEIGHT='1' WIDTH='1' src='{$this->tracking_url}index.php?entryPoint=image&identifier={$this->target_tracker_key}'>";
$mail->AltBody = $template_data['body'];
if ($btracker) {
$mail->AltBody .="\n". $tracker_url;
}
if ($this->has_optout_links==false) {
$mail->AltBody .="\n\n\n{$mod_strings['TXT_REMOVE_ME_ALT']} ". $this->tracking_url . "index.php?entryPoint=removeme&identifier=$this->target_tracker_key";
}
}
// cn: bug 4684, handle attachments in email templates.
$mail->handleAttachments($this->notes_array);
$tmp_Subject = $mail->Subject;
$mail->prepForOutbound();
$success = $mail->Send();
//Do not save the encoded subject.
$mail->Subject = $tmp_Subject;
if($success ){
$email_id=null;
if ($save_emails==1) {
$email_id=$this->create_indiv_email($module,$mail);
} else {
//find/create reference email record. all campaign targets reveiving this message will be linked with this message.
$email_id=$this->create_ref_email($this->marketing_id,
$this->current_emailtemplate->subject,
$this->current_emailtemplate->body,
$this->current_emailtemplate->body_html,
$this->current_campaign->name,
$this->mailbox_from_addr,
$this->user_id,
$this->notes_array,
$macro_nv,
$this->newmessage
);
$this->newmessage = false;
}
}
if ($success) {
$this->set_as_sent($module->email1, true, $email_id, 'Emails', 'targeted');
} else {
if(!empty($layout_def['parent_id'])) {
if (isset($layout_def['fields'][strtoupper($layout_def['parent_id'])])) {
$parent.="&parent_id=".$layout_def['fields'][strtoupper($layout_def['parent_id'])];
}
}
if(!empty($layout_def['parent_module'])) {
if (isset($layout_def['fields'][strtoupper($layout_def['parent_module'])])) {
$parent.="&parent_module=".$layout_def['fields'][strtoupper($layout_def['parent_module'])];
}
}
//log send error. save for next attempt after 24hrs. no campaign log entry will be created.
$this->set_as_sent($module->email1,false,null,null,'send error');
}
}else{
$success = false;
$this->target_tracker_key=create_guid();
if (isset($module->email_opt_out) && ($module->email_opt_out === 'on' || $module->email_opt_out == '1' || $module->email_opt_out == 1)) {
$this->set_as_sent($module->email1,true,null,null,'removed');
} else {
if (isset($module->invalid_email) && ($module->invalid_email == 1 || $module->invalid_email == '1')) {
$this->set_as_sent($module->email1,true,null,null,'invalid email');
} else {
$this->set_as_sent($module->email1,true, null,null,'send error');
}
}
}
return $success;
}
/*
* Validates the passed email address.
* Limitations of this algorithm: does not validate email addressess that end with .meuseum
*
*/
function valid_email_address($email_address) {
$email_address=trim($email_address);
if (empty($email_address)) {
return false;
}
$pattern='/[A-Z0-9\._%-]+@[A-Z0-9\.-]+\.[A-Za-z]{2,}$/i';
$ret=preg_match($pattern, $email_address);
echo $ret;
if ($ret===false or $ret==0) {
return false;
}
return true;
}
/*
* This function takes in the given bean and searches for a related email address
* that has been designated as primary. If one is found, true is returned
* If no primary email address is found, then false is returned
*
*/
function is_primary_email_address($bean){
$email_address=trim($bean->email1);
if (empty($email_address)) {
return false;
}
//query for this email address rel and see if this is primary address
$primary_qry = "select email_address_id from email_addr_bean_rel where bean_id = '".$bean->id."' and email_addr_bean_rel.primary_address=1 and deleted=0";
$res = $bean->db->query($primary_qry);
$prim_row=$this->db->fetchByAssoc($res);
//return true if this is primary
if (!empty($prim_row)) {
return true;
}
return false;
}
function create_export_query(&$order_by, &$where) {
$custom_join = $this->custom_fields->getJOIN(true, true,$where);
$query = "SELECT emailman.*";
if($custom_join){
$query .= $custom_join['select'];
}
$query .= " FROM emailman ";
if($custom_join){
$query .= $custom_join['join'];
}
$where_auto = "( emailman.deleted IS NULL OR emailman.deleted=0 )";
if($where != "")
$query .= "where ($where) AND ".$where_auto;
else
$query .= "where ".$where_auto;
if(!empty($order_by))
$query .= " ORDER BY ". $this->process_order_by($order_by, null);
return $query;
}
}
?>

View File

@@ -0,0 +1,264 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once('include/SugarPHPMailer.php');
$test=false;
if (isset($_REQUEST['mode']) && $_REQUEST['mode']=='test') {
$test=true;
}
if (isset($_REQUEST['send_all']) && $_REQUEST['send_all']== true) {
$send_all= true;
}
else {
$send_all=false; //if set to true email delivery will continue..to run until all email have been delivered.
}
$GLOBALS['log'] = LoggerManager::getLogger('SugarCRM');
$mail = new SugarPHPMailer();
$admin = new Administration();
$admin->retrieveSettings();
if (isset($admin->settings['massemailer_campaign_emails_per_run'])) {
$max_emails_per_run=$admin->settings['massemailer_campaign_emails_per_run'];
}
if (empty($max_emails_per_run)) {
$max_emails_per_run=500;//default
}
//save email copies?
$massemailer_email_copy=0; //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 = "no-reply@example.com";
$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();
$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 propsect 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_convert("'".gmdate($GLOBALS['timedate']->get_db_date_time_format())."'" ,"datetime");
$select_query.=" AND (em.in_queue ='0' OR ( em.in_queue ='1' AND em.in_queue_date <= " .db_convert("'". gmdate($GLOBALS['timedate']->get_db_date_time_format(), strtotime("-1 day")) ."'" ,"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{
//this is not a test..
//find all the message that meet the following criteria.
//1. scheduled send date time is now
//2. were never processed or last attempt was 24 hours ago
$select_query =" SELECT *";
$select_query.=" FROM $emailman->table_name";
$select_query.=" WHERE send_date_time <= ". db_convert("'".gmdate($GLOBALS['timedate']->get_db_date_time_format())."'" ,"datetime");
$select_query.=" AND (in_queue ='0' OR ( in_queue ='1' AND in_queue_date <= " .db_convert("'". gmdate($GLOBALS['timedate']->get_db_date_time_format(), strtotime("-1 day")) ."'" ,"datetime")."))";
if (!empty($campaign_id)) {
$select_query.=" AND campaign_id='{$campaign_id}'";
}
$select_query.=" ORDER BY send_date_time ASC,user_id, list_id";
}
do {
$no_items_in_queue=true;
echo $select_query;
$result = $db->limitQuery($select_query,0,$max_emails_per_run);
global $current_user;
if(isset($current_user)){
$temp_user = $current_user;
}
$current_user = new User();
$startTime = microtime(true);
while(($row = $db->fetchByAssoc($result))!= null){
//verify the queue item before further processing.
//we have found cases where users have taken away access to email templates while them message is in queue.
if (empty($row['campaign_id'])) {
$GLOBALS['log']->fatal('Skipping emailman entry with empty campaign id' . print_r($row,true));
continue;
}
if (empty($row['marketing_id'])) {
$GLOBALS['log']->fatal('Skipping emailman entry with empty marketing id' . print_r($row,true));
continue; //do not process this row .
}
//fetch user that scheduled the campaign.
if(empty($current_user) or $row['user_id'] != $current_user->id){
$current_user->retrieve($row['user_id']);
}
if (!$emailman->verify_campaign($row['marketing_id'])) {
$GLOBALS['log']->fatal('Error verifying templates for the campaign, exiting');
continue;
}
//verify the email template too..
//find the template associated with marketing message. make sure that template has a subject and
//a non-empty body
if (!isset($template_status[$row['marketing_id']])) {
if (!class_exists('EmailMarketing')) {
}
$current_emailmarketing=new EmailMarketing();
$current_emailmarketing->retrieve($row['marketing_id']);
if (!class_exists('EmailTemplate')) {
}
$current_emailtemplate= new EmailTemplate();
$current_emailtemplate->retrieve($current_emailmarketing->template_id);
}
//acquire a lock.
//if the database does not support repeatable read isolation by default, we might get data that does not meet
//the criteria in the original query, and we care most about the in_queue_date and process_date_time,
//if they are null or in past(older than 24 horus) then we are okay.
$lock_query="UPDATE emailman SET in_queue=1, in_queue_date='". gmdate($GLOBALS['timedate']->get_db_date_time_format()) ."' WHERE id = '${row['id']}'";
$lock_query.=" AND (in_queue ='0' OR ( in_queue ='1' AND in_queue_date <= " .db_convert("'". gmdate($GLOBALS['timedate']->get_db_date_time_format(), strtotime("-1 day")) ."'" ,"datetime")."))";
//if the query fails to execute.. terminate campaign email process.
$lock_result=$db->query($lock_query,true,'Error acquiring a lock for emailman entry.');
if ($db->dbType=='oci8') {
} else {
$lock_count=$db->getAffectedRowCount();
}
//do not process the message if unable to acquire lock.
if ($lock_count!= 1) {
$GLOBALS['log']->fatal("Error acquiring lock for the emailman entry, skipping email delivery. lock status=$lock_count " . print_r($row,true));
continue; //do not process this row we will examine it after 24 hrs. the email address based dupe check is in place too.
}
$no_items_in_queue=false;
foreach($row as $name=>$value){
$emailman->$name = $value;
}
//for the campaign process the supression lists.
if (!isset($current_campaign_id) or empty($current_campaign_id) or $current_campaign_id != $row['campaign_id']) {
$current_campaign_id= $row['campaign_id'];
//is this email address suppressed?
$plc_query= " SELECT prospect_list_id, prospect_lists.list_type,prospect_lists.domain_name FROM prospect_list_campaigns ";
$plc_query.=" LEFT JOIN prospect_lists on prospect_lists.id = prospect_list_campaigns.prospect_list_id";
$plc_query.=" WHERE ";
$plc_query.=" campaign_id='{$current_campaign_id}' ";
$plc_query.=" AND prospect_lists.list_type in ('exempt_address','exempt_domain')";
$plc_query.=" AND prospect_list_campaigns.deleted=0";
$plc_query.=" AND prospect_lists.deleted=0";
$emailman->restricted_domains=array();
$emailman->restricted_addresses=array();
$result1=$db->query($plc_query);
while($row1 = $db->fetchByAssoc($result1)){
if ($row1['list_type']=='exempt_domain') {
$emailman->restricted_domains[strtolower($row1['domain_name'])]=1;
} else {
//find email address of targets in this prospect list.
$email_query = "SELECT email_address FROM email_addresses ea JOIN email_addr_bean_rel eabr ON ea.id = eabr.email_address_id JOIN prospect_lists_prospects plp ON eabr.bean_id = plp.related_id AND eabr.bean_module = plp.related_type AND plp.prospect_list_id = '{$row1['prospect_list_id']}' and plp.deleted = 0";
$email_query_result=$db->query($email_query);
while($email_address = $db->fetchByAssoc($email_query_result)){
//ignore empty email addresses;
if (!empty($email_address['email_address'])) {
$emailman->restricted_addresses[strtolower($email_address['email_address'])]=1;
}
}
}
}
}
if(!$emailman->sendEmail($mail,$massemailer_email_copy,$test)){
$GLOBALS['log']->fatal("Email delivery FAILURE:" . print_r($row,true));
} else {
$GLOBALS['log']->debug("Email delivery SUCCESS:" . print_r($row,true));
}
if($mail->isError()){
$GLOBALS['log']->fatal("Email delivery error:" . print_r($row,true). $mail->ErrorInfo);
}
}
$send_all=$send_all?!$no_items_in_queue:$send_all;
}while ($send_all == true);
if ($admin->settings['mail_sendtype'] == "SMTP") {
$mail->SMTPClose();
}
if(isset($temp_user)){
$current_user = $temp_user;
}
if (isset($_REQUEST['return_module']) && isset($_REQUEST['return_action']) && isset($_REQUEST['return_id'])) {
$from_wiz=' ';
if(isset($_REQUEST['from_wiz'])&& $_REQUEST['from_wiz']==true){
header("Location: index.php?module={$_REQUEST['return_module']}&action={$_REQUEST['return_action']}&record={$_REQUEST['return_id']}&from=test");
}else{
header("Location: index.php?module={$_REQUEST['return_module']}&action={$_REQUEST['return_action']}&record={$_REQUEST['return_id']}");
}
} else {
/* this will be triggered when manually sending off Email campaigns from the
* Mass Email Queue Manager.
*/
if(isset($_POST['manual'])) {
header("Location: index.php?module=EmailMan&action=index");
}
}
?>

184
modules/EmailMan/Forms.php Executable file
View File

@@ -0,0 +1,184 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: Contains a variety of utility functions specific to this module.
********************************************************************************/
/**
* Create javascript to validate the data entered into a record.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
*/
function get_validate_record_js () {
global $mod_strings;
global $app_strings;
$lbl_email_per_run = $mod_strings['LBL_EMAILS_PER_RUN'];
$lbl_location = $mod_strings['LBL_LOCATION_ONLY'];
$err_int_only=$mod_strings['ERR_INT_ONLY_EMAIL_PER_RUN'];
$err_missing_required_fields = $app_strings['ERR_MISSING_REQUIRED_FIELDS'];
$err_from_name = $mod_strings['LBL_LIST_FROM_NAME'];
$err_from_addr = $app_strings['LBL_EMAIL_SETTINGS_FROM_ADDR'];
$err_smtpport = $mod_strings['LBL_MAIL_SMTPPORT'];
$err_mailserver = $mod_strings['LBL_MAIL_SMTPSERVER'];
$err_smtpuser = $mod_strings['LBL_MAIL_SMTPUSER'];
$err_smtppass = $mod_strings['LBL_MAIL_SMTPPASS'];
$the_script = <<<EOQ
<script type="text/javascript" language="Javascript">
<!-- to hide script contents from old browsers
/**
* DHTML date validation script. Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/)
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
*/
// Declaring valid date character, minimum year and maximum year
function isInteger(s){
var i;
for (i = 0; i < s.length; i++){
// Check that current character is number.
var c = s.charAt(i);
if (((c < "0") || (c > "9"))) return false;
}
// All characters are numbers.
return true;
}
function trim(s) {
while (s.substring(0,1) == " ") {
s = s.substring(1, s.length);
}
while (s.substring(s.length-1, s.length) == ' ') {
s = s.substring(0,s.length-1);
}
return s;
}
function verify_data(button) {
var isError = false;
var errorMessage = "";
if (typeof button.form['campaign_emails_per_run'] != 'undefined' && trim(button.form['campaign_emails_per_run'].value) == "") {
isError = true;
errorMessage += "\\n$lbl_email_per_run";
} else {
//make sure emails per run is an integer.
if (typeof button.form['campaign_emails_per_run'] != 'undefined' && isInteger(trim(button.form['campaign_emails_per_run'].value)) == false) {
isError = true;
errorMessage += "\\n$err_int_only";
}
}
if (typeof button.form['tracking_entities_location_type'] != 'undefined' && button.form['tracking_entities_location_type'][1].checked == true) {
if (typeof button.form['tracking_entities_location'] != 'undefined' && trim(button.form['tracking_entities_location'].value) == "") {
isError = true;
errorMessage += "\\n$lbl_location";
}
}
if (typeof document.forms['ConfigureSettings'] != 'undefined') {
var fromname = document.getElementById('notify_fromname').value;
var fromAddress = document.getElementById('notify_fromaddress').value;
var sendType = document.getElementById('mail_sendtype').value;
var smtpPort = document.getElementById('mail_smtpport').value;
var smtpserver = document.getElementById('mail_smtpserver').value;
var mailsmtpauthreq = document.getElementById('mail_smtpauth_req');
if(trim(fromname) == "") {
isError = true;
errorMessage += "\\n$err_from_name";
}
if(trim(fromAddress) == "") {
isError = true;
errorMessage += "\\n$err_from_addr";
}
if (sendType == 'SMTP') {
if(trim(smtpserver) == "") {
isError = true;
errorMessage += "\\n$err_mailserver";
}
if(trim(smtpPort) == "") {
isError = true;
errorMessage += "\\n$err_smtpport";
}
if (mailsmtpauthreq.checked) {
if(trim(document.getElementById('mail_smtpuser').value) == "") {
isError = true;
errorMessage += "\\n$err_smtpuser";
}
if(trim(document.getElementById('mail_smtppass').value) == "") {
isError = true;
errorMessage += "\\n$err_smtppass";
}
}
} // if
} // if
// Here we decide whether to submit the form.
if (isError == true) {
alert("$err_missing_required_fields" + errorMessage);
return false;
}
return true;
}
function add_checks(f) {
removeFromValidate('ConfigureSettings', 'mail_smtpserver');
removeFromValidate('ConfigureSettings', 'mail_smtpport');
removeFromValidate('ConfigureSettings', 'mail_smtpuser');
removeFromValidate('ConfigureSettings', 'mail_smtppass');
if (f.mail_sendtype.value == "SMTP") {
addToValidate('ConfigureSettings', 'mail_smtpserver', 'varchar', 'true', '{$mod_strings['LBL_MAIL_SMTPSERVER']}');
addToValidate('ConfigureSettings', 'mail_smtpport', 'int', 'true', '{$mod_strings['LBL_MAIL_SMTPPORT']}');
if (f.mail_smtpauth_req.checked) {
addToValidate('ConfigureSettings', 'mail_smtpuser', 'varchar', 'true', '{$mod_strings['LBL_MAIL_SMTPUSER']}');
addToValidate('ConfigureSettings', 'mail_smtppass', 'varchar', 'true', '{$mod_strings['LBL_MAIL_SMTPPASS']}');
}
}
return true;
}
// end hiding contents from old browsers -->
</script>
EOQ;
return $the_script;
}
?>

46
modules/EmailMan/Menu.php Executable file
View File

@@ -0,0 +1,46 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: TODO To be written.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
$module_menu=array();

125
modules/EmailMan/Save.php Executable file
View File

@@ -0,0 +1,125 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: TODO: To be written.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
require_once('include/OutboundEmail/OutboundEmail.php');
global $current_user;
if ( !is_admin($current_user)
&& !is_admin_for_module($GLOBALS['current_user'],'Emails')
&& !is_admin_for_module($GLOBALS['current_user'],'Campaigns') ){
sugar_die("Unauthorized access to administration.");
}
//Do not allow users to spoof for sendmail if the config flag is not set.
if( !isset($sugar_config['allow_sendmail_outbound']) || !$sugar_config['allow_sendmail_outbound'])
$_REQUEST['mail_sendtype'] = "SMTP";
// save Outbound settings #Bug 20033 Ensure data for Outbound email exists before trying to update the system mailer.
if(isset($_REQUEST['mail_sendtype']) && empty($_REQUEST['campaignConfig'])) {
$oe = new OutboundEmail();
$oe->populateFromPost();
$oe->saveSystem();
}
$focus = new Administration();
if(isset($_POST['tracking_entities_location_type'])) {
if ($_POST['tracking_entities_location_type'] != '2') {
unset($_POST['tracking_entities_location']);
unset($_POST['tracking_entities_location_type']);
}
}
// cn: handle mail_smtpauth_req checkbox on/off (removing double reference in the form itself
if( !isset($_POST['mail_smtpauth_req']) )
{
$_POST['mail_smtpauth_req'] = 0;
$_POST['notify_allow_default_outbound'] = 0; //If smtp auth is disabled ensure outbound is disabled.
}
//Remove previous user override accoutns if users are now able to use the default account but previously weren't.
if( !empty($_POST['notify_allow_default_outbound']) )
{
$oe = new OutboundEmail();
if( !$oe->isAllowUserAccessToSystemDefaultOutbound() )
$oe->removeUserOverrideAccounts();
}
$focus->saveConfig();
// save User defaults for emails
$sugar_config['email_default_delete_attachments'] = (isset($_REQUEST['email_default_delete_attachments'])) ? true : false;
///////////////////////////////////////////////////////////////////////////////
//// SECURITY
$security = array();
if(isset($_REQUEST['applet'])) $security['applet'] = 'applet';
if(isset($_REQUEST['base'])) $security['base'] = 'base';
if(isset($_REQUEST['embed'])) $security['embed'] = 'embed';
if(isset($_REQUEST['form'])) $security['form'] = 'form';
if(isset($_REQUEST['frame'])) $security['frame'] = 'frame';
if(isset($_REQUEST['frameset'])) $security['frameset'] = 'frameset';
if(isset($_REQUEST['iframe'])) $security['iframe'] = 'iframe';
if(isset($_REQUEST['import'])) $security['import'] = '\?import';
if(isset($_REQUEST['layer'])) $security['layer'] = 'layer';
if(isset($_REQUEST['link'])) $security['link'] = 'link';
if(isset($_REQUEST['object'])) $security['object'] = 'object';
if(isset($_REQUEST['style'])) $security['style'] = 'style';
if(isset($_REQUEST['xmp'])) $security['xmp'] = 'xmp';
$security['script'] = 'script';
$sugar_config['email_xss'] = base64_encode(serialize($security));
//// SECURITY
///////////////////////////////////////////////////////////////////////////////
ksort($sugar_config);
write_array_to_file('sugar_config', $sugar_config, 'config.php');
header("Location: index.php?action={$_POST['return_action']}&module={$_POST['return_module']}");
?>

View File

@@ -0,0 +1,38 @@
<?php
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
$action_view_map['config'] = 'config';
$action_view_map['campaignconfig'] = 'campaignconfig';

126
modules/EmailMan/controller.php Executable file
View File

@@ -0,0 +1,126 @@
<?php
/*********************************************************************************
* SugarCRM Community Edition is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
class EmailManController extends SugarController
{
function action_Save(){
require_once('include/OutboundEmail/OutboundEmail.php');
require_once('modules/Configurator/Configurator.php');
$configurator = new Configurator();
global $sugar_config;
global $current_user;
if ( !is_admin($current_user)
&& !is_admin_for_module($GLOBALS['current_user'],'Emails')
&& !is_admin_for_module($GLOBALS['current_user'],'Campaigns') ){
sugar_die("Unauthorized access to administration.");
}
//Do not allow users to spoof for sendmail if the config flag is not set.
if( !isset($sugar_config['allow_sendmail_outbound']) || !$sugar_config['allow_sendmail_outbound'])
$_REQUEST['mail_sendtype'] = "SMTP";
// save Outbound settings #Bug 20033 Ensure data for Outbound email exists before trying to update the system mailer.
if(isset($_REQUEST['mail_sendtype']) && empty($_REQUEST['campaignConfig'])) {
$oe = new OutboundEmail();
$oe->populateFromPost();
$oe->saveSystem();
}
$focus = new Administration();
if(isset($_POST['tracking_entities_location_type'])) {
if ($_POST['tracking_entities_location_type'] != '2') {
unset($_POST['tracking_entities_location']);
unset($_POST['tracking_entities_location_type']);
}
}
// cn: handle mail_smtpauth_req checkbox on/off (removing double reference in the form itself
if( !isset($_POST['mail_smtpauth_req']) )
{
$_POST['mail_smtpauth_req'] = 0;
$_POST['notify_allow_default_outbound'] = 0; //If smtp auth is disabled ensure outbound is disabled.
}
if( !empty($_POST['notify_allow_default_outbound']) )
{
$oe = new OutboundEmail();
if( !$oe->isAllowUserAccessToSystemDefaultOutbound() )
$oe->removeUserOverrideAccounts();
}
$focus->saveConfig();
// save User defaults for emails
$configurator->config['email_default_delete_attachments'] = (isset($_REQUEST['email_default_delete_attachments'])) ? true : false;
///////////////////////////////////////////////////////////////////////////////
//// SECURITY
$security = array();
if(isset($_REQUEST['applet'])) $security['applet'] = 'applet';
if(isset($_REQUEST['base'])) $security['base'] = 'base';
if(isset($_REQUEST['embed'])) $security['embed'] = 'embed';
if(isset($_REQUEST['form'])) $security['form'] = 'form';
if(isset($_REQUEST['frame'])) $security['frame'] = 'frame';
if(isset($_REQUEST['frameset'])) $security['frameset'] = 'frameset';
if(isset($_REQUEST['iframe'])) $security['iframe'] = 'iframe';
if(isset($_REQUEST['import'])) $security['import'] = '\?import';
if(isset($_REQUEST['layer'])) $security['layer'] = 'layer';
if(isset($_REQUEST['link'])) $security['link'] = 'link';
if(isset($_REQUEST['object'])) $security['object'] = 'object';
if(isset($_REQUEST['style'])) $security['style'] = 'style';
if(isset($_REQUEST['xmp'])) $security['xmp'] = 'xmp';
$security['script'] = 'script';
$configurator->config['email_xss'] = base64_encode(serialize($security));
//// SECURITY
///////////////////////////////////////////////////////////////////////////////
ksort($sugar_config);
$configurator->handleOverride();
}
}
?>

View File

@@ -0,0 +1,91 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: Contains field arrays that are used for caching
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
$fields_array['EmailMan'] = array ('column_fields' => Array(
"id"
, "date_entered"
, "date_modified"
, 'user_id'
, 'module'
, 'module_id'
, 'marketing_id'
, 'campaign_id'
, 'list_id'
, 'template_id'
, 'from_email'
, 'from_name'
, 'invalid_email'
, 'send_date_time'
, 'in_queue'
, 'in_queue_date'
,'send_attempts'
),
'list_fields' => Array(
"id"
, 'user_id'
, 'module'
, 'module_id'
, 'campaign_id'
, 'marketing_id'
, 'list_id'
, 'invalid_email'
, 'from_name'
, 'from_email'
, 'template_id'
, 'send_date_time'
, 'in_queue'
, 'in_queue_date'
,'send_attempts'
,'user_name'
,'to_email'
,'from_email'
,'campaign_name'
,'to_contact'
,'to_lead'
,'to_prospect'
,'contact_email'
, 'lead_email'
, 'prospect_email'
),
);
?>

View File

@@ -0,0 +1,157 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: Defines the English language pack for the base application.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
$mod_strings = array (
'LBL_SEND_DATE_TIME' => 'Send Date',
'LBL_IN_QUEUE' => 'In Process',
'LBL_IN_QUEUE_DATE' => 'Queued Date',
'ERR_INT_ONLY_EMAIL_PER_RUN' => 'Use only integer values to specify the number of emails sent per batch',
'LBL_ATTACHMENT_AUDIT' => ' was sent. It was not duplicated locally to conserve disk usage.',
'LBL_CONFIGURE_SETTINGS' => 'Configure Email Settings',
'LBL_CUSTOM_LOCATION' => 'User Defined',
'LBL_DEFAULT_LOCATION' => 'Default',
'LBL_DISCLOSURE_TITLE' => 'Append Disclosure Message to Every Email',
'LBL_DISCLOSURE_TEXT_TITLE' => 'Disclosure Contents',
'LBL_DISCLOSURE_TEXT_SAMPLE' => 'NOTICE: This email message is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure, or distribution is prohibited. If you are not the intended recipient, please destroy all copies of the original message and notify the sender so that our address record can be corrected. Thank you.',
'LBL_EMAIL_DEFAULT_CHARSET' => 'Compose email messages in this character set',
'LBL_EMAIL_DEFAULT_EDITOR' => 'Compose email using this client',
'LBL_EMAIL_DEFAULT_DELETE_ATTACHMENTS' => 'Delete related notes & attachments with deleted Emails',
'LBL_EMAIL_GMAIL_DEFAULTS' => 'Prefill Gmail&#153; Defaults',
'LBL_EMAIL_PER_RUN_REQ' => 'Number of emails sent per batch:',
'LBL_EMAIL_SMTP_SSL' => 'Enable SMTP over SSL?',
'LBL_EMAIL_USER_TITLE' => 'User Email Defaults',
'LBL_EMAIL_OUTBOUND_CONFIGURATION' => 'Outgoing Mail Configuration',
'LBL_EMAILS_PER_RUN' => 'Number of emails sent per batch:',
'LBL_ID' => 'Id',
'LBL_LIST_CAMPAIGN' => 'Campaign',
'LBL_LIST_FORM_PROCESSED_TITLE' => 'Processed',
'LBL_LIST_FORM_TITLE' => 'Queue',
'LBL_LIST_FROM_EMAIL' => 'From Email',
'LBL_LIST_FROM_NAME' => 'From Name',
'LBL_LIST_IN_QUEUE' => 'In Process',
'LBL_LIST_MESSAGE_NAME' => 'Marketing Message',
'LBL_LIST_RECIPIENT_EMAIL' => 'Recipient Email',
'LBL_LIST_RECIPIENT_NAME' => 'Recipient Name',
'LBL_LIST_SEND_ATTEMPTS' => 'Send Attempts',
'LBL_LIST_SEND_DATE_TIME' => 'Send On',
'LBL_LIST_USER_NAME' => 'User Name',
'LBL_LOCATION_ONLY' => 'Location',
'LBL_LOCATION_TRACK' => 'Location of campaign tracking files (like campaign_tracker.php)',
'LBL_CAMP_MESSAGE_COPY' => 'Keep copies of campaign messages:',
'LBL_CAMP_MESSAGE_COPY_DESC' => 'Would you like to store complete copies of <bold>EACH</bold> email message sent during all campaigns? <bold>We recommend and default to no</bold>. Choosing no will store only the template that is sent and the needed variables to recreate the individual message.',
'LBL_MAIL_SENDTYPE' => 'Mail Transfer Agent:',
'LBL_MAIL_SMTPAUTH_REQ' => 'Use SMTP Authentication:',
'LBL_MAIL_SMTPPASS' => 'Password:',
'LBL_MAIL_SMTPPORT' => 'SMTP Port:',
'LBL_MAIL_SMTPSERVER' => 'SMTP Mail Server:',
'LBL_MAIL_SMTPUSER' => 'Username:',
'LBL_CHOOSE_EMAIL_PROVIDER' => 'Choose your Email provider',
'LBL_YAHOOMAIL_SMTPPASS' => 'Yahoo! Mail Password',
'LBL_YAHOOMAIL_SMTPUSER' => 'Yahoo! Mail ID',
'LBL_GMAIL_SMTPPASS' => 'Gmail Password',
'LBL_GMAIL_SMTPUSER' => 'Gmail Email Address',
'LBL_EXCHANGE_SMTPPASS' => 'Exchange Password',
'LBL_EXCHANGE_SMTPUSER' => 'Exchange Username',
'LBL_EXCHANGE_SMTPPORT' => 'Exchange Server Port',
'LBL_EXCHANGE_SMTPSERVER' => 'Exchange Server',
'LBL_EMAIL_LINK_TYPE' => 'Email Client',
'LBL_EMAIL_LINK_TYPE_HELP' => '<b>Sugar Mail Client:</b> Send emails using the email client in the Sugar application.<br><b>External Mail Client:</b> Send email using an email client outside of the Sugar application, such as Microsoft Outlook.',
'LBL_MARKETING_ID' => 'Marketing Id',
'LBL_MODULE_ID' => 'EmailMan',
'LBL_MODULE_NAME' => 'Email Settings',
'LBL_CONFIGURE_CAMPAIGN_EMAIL_SETTINGS' => 'Configure Campaign Email Settings',
'LBL_MODULE_TITLE' => 'Outbound Email Queue Management',
'LBL_NOTIFICATION_ON_DESC' => 'When enabled, emails are sent to users when records are assigned to them.',
'LBL_NOTIFY_FROMADDRESS' => '"From" Address:',
'LBL_NOTIFY_FROMNAME' => '"From" Name:',
'LBL_NOTIFY_ON' => 'Assignment Notifications',
'LBL_NOTIFY_SEND_BY_DEFAULT' => 'Send notifications to new users',
'LBL_NOTIFY_TITLE' => 'Email Options',
'LBL_OLD_ID' => 'Old Id',
'LBL_OUTBOUND_EMAIL_TITLE' => 'Outbound Email Options',
'LBL_RELATED_ID' => 'Related Id',
'LBL_RELATED_TYPE' => 'Related Type',
'LBL_SAVE_OUTBOUND_RAW' => 'Save Outbound Raw Emails',
'LBL_SEARCH_FORM_PROCESSED_TITLE' => 'Processed Search',
'LBL_SEARCH_FORM_TITLE' => 'Queue Search',
'LBL_VIEW_PROCESSED_EMAILS' => 'View Processed Emails',
'LBL_VIEW_QUEUED_EMAILS' => 'View Queued Emails',
'TRACKING_ENTRIES_LOCATION_DEFAULT_VALUE' => 'Value of Config.php setting site_url',
'TXT_REMOVE_ME_ALT' => 'To remove yourself from this email list go to',
'TXT_REMOVE_ME_CLICK' => 'click here',
'TXT_REMOVE_ME' => 'To remove yourself from this email list ',
'LBL_NOTIFY_SEND_FROM_ASSIGNING_USER' => 'Send notification from assigning user\'s e-mail address',
'LBL_SECURITY_TITLE' => 'Email Security Settings',
'LBL_SECURITY_DESC' => 'Check the following that should NOT be allowed in via InboundEmail or displayed in the Emails module.',
'LBL_SECURITY_APPLET' => 'Applet tag',
'LBL_SECURITY_BASE' => 'Base tag',
'LBL_SECURITY_EMBED' => 'Embed tag',
'LBL_SECURITY_FORM' => 'Form tag',
'LBL_SECURITY_FRAME' => 'Frame tag',
'LBL_SECURITY_FRAMESET' => 'Frameset tag',
'LBL_SECURITY_IFRAME' => 'iFrame tag',
'LBL_SECURITY_IMPORT' => 'Import tag',
'LBL_SECURITY_LAYER' => 'Layer tag',
'LBL_SECURITY_LINK' => 'Link tag',
'LBL_SECURITY_OBJECT' => 'Object tag',
'LBL_SECURITY_OUTLOOK_DEFAULTS' => 'Select Outlook default minimum security settings (errs on the side of correct display).',
'LBL_SECURITY_SCRIPT' => 'Script tag',
'LBL_SECURITY_STYLE' => 'Style tag',
'LBL_SECURITY_TOGGLE_ALL' => 'Toggle All Options',
'LBL_SECURITY_XMP' => 'Xmp tag',
'LBL_YES' => 'Yes',
'LBL_NO' => 'No',
'LBL_PREPEND_TEST' => '[Test]: ',
'LBL_SEND_ATTEMPTS' => 'Send Attempts',
'LBL_OUTGOING_SECTION_HELP' => 'Configure the default outgoing mail server for sending email notifications, including workflow alerts.',
'LBL_ALLOW_DEFAULT_SELECTION' => 'Allow users to use this account for outgoing email:',
'LBL_ALLOW_DEFAULT_SELECTION_HELP' => 'When this option selected, all users will be able to send emails using the same outgoing<br> mail account used to send system notifications and alerts. If the option is not selected,<br> users can still use the outgoing mail server after providing their own account information.',
);
?>

View File

@@ -0,0 +1,130 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* The contents of this file are subject to the SugarCRM Public License Version
* 1.1.3 ("License"); You may not use this file except in compliance with the
* License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* All copies of the Covered Code must include on each user interface screen:
* (i) the "Powered by SugarCRM" logo and
* (ii) the SugarCRM copyright notice
* in the same form as they appear in the distribution. See full license for
* requirements.
*
* The Original Code is: SugarCRM Open Source
* The Initial Developer of the Original Code is SugarCRM, Inc.
* Portions created by SugarCRM are Copyright (C) 2004-2005 SugarCRM, Inc.;
* All Rights Reserved.
* Contributor(s): ______________________________________.
********************************************************************************/
/*********************************************************************************
* pl_pl.lang.ext.php,v for SugarCRM 4.5.1-->>
* Translator: Krzysztof Morawski
* All Rights Reserved.
* Any bugs report welcome: krzysiek<at>kmmgroup<dot>pl
* Contributor(s): ______________________________________..
********************************************************************************/
$mod_strings = array (
'LBL_SEND_DATE_TIME' => 'Wyślij Datę',
'LBL_IN_QUEUE' => 'W kolejce?',
'LBL_IN_QUEUE_DATE' => 'Data kolejkowania',
'ERR_INT_ONLY_EMAIL_PER_RUN'=>'Tylko wartości liczbowe są dowzolone dla oznaczenia liczby wiadomości wysłanych w jednej serii',
'LBL_ATTACHMENT_AUDIT'=> ' zostały wysłane. Nie zostały zduplikowane lokalnie, by nie zajmować miejsca na dysku.',
'LBL_CONFIGURE_SETTINGS'=>'Konfiguruj',
'LBL_CUSTOM_LOCATION'=>'Definiowane przez użytkownika',
'LBL_DEFAULT_LOCATION'=>'Domyślnie',
'LBL_DISCLOSURE_TITLE' => 'Dodaje Stopkę o niejawności do każdej Wiadomości',
'LBL_DISCLOSURE_TEXT_TITLE' => 'Treść Stopki o niejawności',
'LBL_DISCLOSURE_TEXT_SAMPLE' => 'NOTICE: This email message is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure, or distribution is prohibited. If you are not the intended recipient, please destroy all copies of the original message and notify the sender so that our address record can be corrected. Thank you.
<br>Uwaga: Ta wiadomość jest skierowana wyłączenie do użytku określonych odbiorców i może zawierać treści przeznaczone tylko dla nich. Jakiekolwiek nieautoryzowane ujawnianie, używanie, lub dystrybuowanie tych treści jest zabrionione. Jeśli nie jesteś adresatem tej wiadomości, usuń jej wszystkie kopie i powiadom nadawcę, aby poprawił swoją książkę adresową. Dziekujemy',
'LBL_EMAIL_DEFAULT_CHARSET'=> 'Komponuj wiadomości pocztowe w tym zestawie znaków',
'LBL_EMAIL_DEFAULT_CLIENT' => 'Napisz wiadomowść email, korzystając z tego formatu',
'LBL_EMAIL_DEFAULT_EDITOR'=> 'Napisz wiadomość, korzystając z tego klienta poczty',
'LBL_EMAIL_DEFAULT_DELETE_ATTACHMENTS'=> 'Usuń połączone notatki i załączniki połączone z usuniętymi Wiadomościami Pocztowymi.',
'LBL_EMAIL_GMAIL_DEFAULTS' => 'Wypełnij domyślne ustawienia dla Gmail',
'LBL_EMAIL_PER_RUN_REQ'=>'Liczba wiadomości wysłanych w serii:',
'LBL_EMAIL_SMTP_SSL' => 'Włącz SMTP przez SSL',
'LBL_EMAIL_USER_TITLE'=> 'Użyj domyślnego adresu email',
'LBL_EMAILS_PER_RUN'=>'Liczba wiadomości wysyłanych w serii:',
'LBL_ID' => 'Id',
'LBL_LIST_CAMPAIGN'=> 'Kampania',
'LBL_LIST_FORM_PROCESSED_TITLE'=>'Trwające',
'LBL_LIST_FORM_TITLE'=>'Oczekujące',
'LBL_LIST_FROM_EMAIL'=>'Od adres nadawcy',
'LBL_LIST_FROM_NAME'=>'Od nazwa',
'LBL_LIST_IN_QUEUE'=>'W trakcie',
'LBL_LIST_MESSAGE_NAME'=>'Wiadomość marketingowa',
'LBL_LIST_RECIPIENT_EMAIL'=>'Adres odbiorcy',
'LBL_LIST_RECIPIENT_NAME'=>'Nazwa odbiorcy',
'LBL_LIST_SEND_ATTEMPTS'=>'Próba wysłania',
'LBL_LIST_SEND_DATE_TIME'=>'Wysłane O',
'LBL_LIST_USER_NAME'=>'Nazwa użytkownika',
'LBL_LOCATION_ONLY'=>'Lokalizacja',
'LBL_LOCATION_TRACK'=>'Lokalizacja pliku śledzenia trwania kampanii (jak campaign_tracker.php)',
'LBL_CAMP_MESSAGE_COPY'=> 'Zachowaj kopie wiadomości kampanii:',
'LBL_CAMP_MESSAGE_COPY_DESC'=> 'Czy chcesz zachować kompletną kopię wiadomości wysłanych podczas wszystkich kampanii? <bold>Zaleca się pozostawienie opcji w domyślnym ustawieniu - Nie</bold>. Wybierając <bold>Nie</bold>, zachowane zostaną wzory i niezbędne zmienne wiadomości, aby odtworzyć oryginalną wiadomość.',
'LBL_MAIL_SENDTYPE'=> 'Typ serwera poczty (MTA):',
'LBL_MAIL_SMTPAUTH_REQ'=> 'Użyj uwierzytelnienia SMTP?',
'LBL_MAIL_SMTPPASS'=> 'Hasło SMTP:',
'LBL_MAIL_SMTPPORT'=> 'Port SMTP:',
'LBL_MAIL_SMTPSERVER'=> 'Nazwa serwera SMTP:',
'LBL_MAIL_SMTPUSER'=> 'Nazwa użytkownika SMTP:',
'LBL_MARKETING_ID'=>'Marketing Id',
'LBL_MODULE_ID' => 'Zarządzanie pocztą',
'LBL_MODULE_NAME'=>'Masowa wysyłka',
'LBL_CAMP_MODULE_NAME' => 'Ustawienia wiadomości kampanii',
'LBL_MODULE_TITLE' => 'Zarządzanie kolejkowaniem masowej wysyłki',
'LBL_NOTIFICATION_ON_DESC' => 'Wysyłaj powiadomienie emailem, gdy rekordy są przydzielone.',
'LBL_NOTIFY_FROMADDRESS' => 'Adres "Od":',
'LBL_NOTIFY_FROMNAME' => 'Nazwa "Od":',
'LBL_NOTIFY_ON'=> 'Powiadomienia włączone?',
'LBL_NOTIFY_SEND_BY_DEFAULT'=> 'Wysyła powiadomienia domyślnie dla nowych Użytkowników?',
'LBL_NOTIFY_TITLE'=> 'Opcje powiadamiania wiadomości pocztowych',
'LBL_OLD_ID'=>'Dawne Id',
'LBL_OUTBOUND_EMAIL_TITLE'=> 'Opcje dla wiadomości wychodzących',
'LBL_RELATED_ID'=>'Połączone Id',
'LBL_RELATED_TYPE'=>'Połączony typ',
'LBL_SAVE_OUTBOUND_RAW'=> 'Zapisz źródło wiadomości wychodzących',
'LBL_SEARCH_FORM_PROCESSED_TITLE'=>'Przeprowadź poszukiwanie',
'LBL_SEARCH_FORM_TITLE'=>'Przeszukaj oczekujące',
'LBL_VIEW_PROCESSED_EMAILS'=>'Obejrzyj trwające wysyłki',
'LBL_VIEW_QUEUED_EMAILS'=>'Obejrzyj oczekujące wysyłki',
'TRACKING_ENTRIES_LOCATION_DEFAULT_VALUE'=> 'Wartość zmiennej site_urlw pliku Config.php',
'TXT_REMOVE_ME_ALT'=>'Aby usunąć siebie z listy wysyłkowej idź do',
'TXT_REMOVE_ME_CLICK'=>'Kliknij tutaj',
'TXT_REMOVE_ME'=>'Aby usunąć siebie z tej listy wysyłkowej',
'LBL_NOTIFY_SEND_FROM_ASSIGNING_USER' => 'Czy wysłać powiadomienie z przydzielonego do użytkownika adresu?',
'LBL_SECURITY_TITLE'=> 'Ustawienia zabezpieczeń wiadomości pocztowych',
'LBL_SECURITY_DESC'=> 'Poniżej zaznacz elementy, które NIE powinny być dozwolone w poczcie przychodzącej, lub wyświetlane w Module Poczty.',
'LBL_SECURITY_APPLET' => 'Znacznik apletu',
'LBL_SECURITY_BASE' => 'Znaczik podstawowy',
'LBL_SECURITY_EMBED' => 'Znacznik osadzony',
'LBL_SECURITY_FORM' => 'Znacznik formularza',
'LBL_SECURITY_FRAME' => 'Znacznik ramki',
'LBL_SECURITY_FRAMESET' => 'Znacznik zestawu ramek',
'LBL_SECURITY_IFRAME' => 'Znacznik iFrame',
'LBL_SECURITY_IMPORT' => 'Znacznik importu',
'LBL_SECURITY_LAYER' => 'Znacznik warstwy',
'LBL_SECURITY_LINK' => 'Znacznik linku',
'LBL_SECURITY_OBJECT' => 'Znacznik obiektu',
'LBL_SECURITY_OUTLOOK_DEFAULTS'=> 'Wybierz domyślne minimalne środki bezpieczeństwa Outlooka (błędy na prawidłowo wyświetlonej stronie).',
'LBL_SECURITY_PRESERVE_RAW'=> 'Zabezpiecz źródła wiadomości, zawierającym potencjalnie niebezpieczną zawartość. Ta opcja zabezpieczy nagłówki wiadomości w bazie danych. Nie pozwala ona na ekpozycję niefiltrowanej zawartości przez SugarCRM UI.<br /><span class="error"></span> Może to prowadzić do obniżenia wydajności systemu.',
'LBL_SECURITY_SCRIPT' => 'Znacznik skryptu',
'LBL_SECURITY_STYLE' => 'Znacznik stylu',
'LBL_SECURITY_TOGGLE_ALL' => 'Zaznacz wszystko',
'LBL_SECURITY_XMP' => 'Znacznik Xmp',
'LBL_YES' => 'Tak',
'LBL_NO' => 'Nie',
'LBL_PREPEND_TEST' => '[Test]: ',
'LBL_SEND_ATTEMPTS' => 'Próby wysyłki',
);
?>

View File

@@ -0,0 +1,44 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
$searchFields['EmailMan'] =
array (
'campaign_name' => array( 'query_type'=>'default','db_field'=>array('campaigns.name')),
'to_name'=> array('query_type'=>'default','db_field'=>array('contacts.first_name','contacts.last_name','leads.first_name','leads.last_name','prospects.first_name','prospects.last_name')),
'to_email'=> array('query_type'=>'default','db_field'=>array('contacts.email1','leads.email1','prospects.email1')),
'current_user_only'=> array('query_type'=>'default','db_field'=>array('assigned_user_id'),'my_items'=>true, 'vname' => 'LBL_CURRENT_USER_FILTER', 'type' => 'bool'),
);
?>

View File

@@ -0,0 +1,74 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
$listViewDefs['EmailMan'] = array(
'CAMPAIGN_NAME' => array(
'width' => '10',
'label' => 'LBL_LIST_CAMPAIGN',
'link' => true,
'customCode' => '<a href="index.php?module=Campaigns&action=DetailView&record={$CAMPAIGN_ID}">{$CAMPAIGN_NAME}</a>',
'default' => true),
'RECIPIENT_NAME' => array(
'width' => '10',
'label' => 'LBL_LIST_RECIPIENT_NAME',
'customCode' => '<a href="index.php?module={$RELATED_TYPE}&action=DetailView&record={$RELATED_ID}">{$RECIPIENT_NAME}</a>',
'default' => true),
'RECIPIENT_EMAIL' => array(
'width' => '10',
'label' => 'LBL_LIST_RECIPIENT_EMAIL',
'customCode' => '{$EMAIL1_LINK}{$RECIPIENT_EMAIL}</a>',
'default' => true),
'MESSAGE_NAME' => array(
'width' => '10',
'label' => 'LBL_LIST_MESSAGE_NAME',
'customCode' => '<a href="index.php?module=EmailMarketing&action=DetailView&record={$MARKETING_ID}">{$MESSAGE_NAME}</a>',
'default' => true),
'SEND_DATE_TIME' => array(
'width' => '10',
'label' => 'LBL_LIST_SEND_DATE_TIME',
'default' => true),
'SEND_ATTEMPTS' => array(
'width' => '10',
'label' => 'LBL_LIST_SEND_ATTEMPTS',
'default' => true),
'IN_QUEUE' => array(
'width' => '10',
'label' => 'LBL_LIST_IN_QUEUE',
'default' => true),
);

View File

@@ -0,0 +1,60 @@
<?php
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*
* Created on May 29, 2007
*
* To change the template for this generated file go to
* Window - Preferences - PHPeclipse - PHP - Code Templates
*/
$searchdefs['EmailMan'] = array(
'templateMeta' => array(
'maxColumns' => '3',
'widths' => array('label' => '10', 'field' => '30'),
),
'layout' => array(
'basic_search' => array(
array('name'=>'campaign_name', 'label'=>'LBL_LIST_CAMPAIGN',),
array('name'=>'current_user_only', 'label'=>'LBL_CURRENT_USER_FILTER', 'type'=>'bool'),
),
'advanced_search' => array(
array('name'=>'campaign_name', 'label'=>'LBL_LIST_CAMPAIGN',),
array('name'=>'to_name', 'label'=>'LBL_LIST_RECIPIENT_NAME'),
array('name'=>'to_email', 'label'=>'LBL_LIST_RECIPIENT_EMAIL'),
array('name'=>'current_user_only', 'label'=>'LBL_CURRENT_USER_FILTER', 'type'=>'bool'),
),
),
);
?>

View File

@@ -0,0 +1,77 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
$subpanel_layout = array(
'top_buttons' => array(
),
'where' => '',
'list_fields' => array(
'recipient_name'=>array(
'vname' => 'LBL_LIST_RECIPIENT_NAME',
'width' => '10%',
'sortable'=>false,
),
'recipient_email'=>array(
'vname' => 'LBL_LIST_RECIPIENT_EMAIL',
'width' => '10%',
'sortable'=>false,
),
'message_name' => array(
'vname' => 'LBL_MARKETING_ID',
'width' => '10%',
'sortable'=>false,
),
'send_date_time' => array(
'vname' => 'LBL_LIST_SEND_DATE_TIME',
'width' => '10%',
'sortable'=>false,
),
'related_id'=>array(
'usage'=>'query_only',
),
'related_type'=>array(
'usage'=>'query_only',
),
'marketing_id' => array(
'usage'=>'query_only',
),
),
);
?>

View File

@@ -0,0 +1,77 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
$subpanel_layout = array(
'top_buttons' => array(
),
'where' => '',
'list_fields' => array(
'recipient_name'=>array(
'vname' => 'LBL_LIST_RECIPIENT_NAME',
'width' => '10%',
'sortable'=>false,
),
'recipient_email'=>array(
'vname' => 'LBL_LIST_RECIPIENT_EMAIL',
'width' => '10%',
'sortable'=>false,
),
'message_name' => array(
'vname' => 'LBL_MARKETING_ID',
'width' => '10%',
'sortable'=>false,
),
'send_date_time' => array(
'vname' => 'LBL_LIST_SEND_DATE_TIME',
'width' => '10%',
'sortable'=>false,
),
'related_id'=>array(
'usage'=>'query_only',
),
'related_type'=>array(
'usage'=>'query_only',
),
'marketing_id' => array(
'usage'=>'query_only',
),
),
);
?>

View File

@@ -0,0 +1,61 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: TODO: To be written.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
require_once('modules/Emails/Email.php');
global $mod_strings;
global $app_list_strings;
global $app_strings;
global $current_user;
$json = getJSONobj();
$out = Email::sendEmailTest($_REQUEST['mail_smtpserver'], $_REQUEST['mail_smtpport'], $_REQUEST['mail_smtpssl'],
($_REQUEST['mail_smtpauth_req'] == 'true' ? 1 : 0), $_REQUEST['mail_smtpuser'],
$_REQUEST['mail_smtppass'], $_REQUEST['outboundtest_from_address'], $_REQUEST['outboundtest_to_address'], $_REQUEST['mail_sendtype']);
$out = $json->encode($out);
echo $out;
?>

View File

@@ -0,0 +1,124 @@
{*
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
********************************************************************************/
*}
{$ROLLOVER}
<script type="text/javascript" src="{sugar_getjspath file='modules/Users/User.js'}"></script>
<script type="text/javascript">
<!--
{literal}
function change_state(radiobutton)
{
if (radiobutton.value == '1') {
radiobutton.form['massemailer_tracking_entities_location'].disabled=true;
radiobutton.form['massemailer_tracking_entities_location'].value='{/literal}{$MOD.TRACKING_ENTRIES_LOCATION_DEFAULT_VALUE}{literal}';
}
else {
radiobutton.form['massemailer_tracking_entities_location'].disabled=false;
radiobutton.form['massemailer_tracking_entities_location'].value=null;
}
}
{/literal}
-->
</script>
<form name="ConfigureSettings" id="EditView" method="POST" >
<input type="hidden" name="module" value="EmailMan">
<input type="hidden" name="campaignConfig" value="true">
<input type="hidden" name="action">
<input type="hidden" name="return_module" value="{$RETURN_MODULE}">
<input type="hidden" name="return_action" value="{$RETURN_ACTION}">
<input type="hidden" name="source_form" value="config" />
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="edit view">
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<th align="left" scope="row" colspan="4">
<h4>
{$MOD.LBL_OUTBOUND_EMAIL_TITLE}
</h4>
</th>
</tr>
<tr>
<td width="40%" scope="row">
{$MOD.LBL_EMAILS_PER_RUN}&nbsp;<span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span>
</td>
<td width="50%" >
<input name='massemailer_campaign_emails_per_run' tabindex='1' maxlength='128' type="text" value="{$EMAILS_PER_RUN}">
</td>
</tr>
<tr>
<td scope="row">
{$MOD.LBL_LOCATION_TRACK}&nbsp;<span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span>
</td>
<td >
<input type='radio' onclick="change_state(this);" name='massemailer_tracking_entities_location_type' value="1" {$default_checked}>
{$MOD.LBL_DEFAULT_LOCATION}&nbsp;<input type='radio' {$userdefined_checked} onclick="change_state(this);" name='massemailer_tracking_entities_location_type' value="2">{$MOD.LBL_CUSTOM_LOCATION}
</tr>
<tr>
<td scope="row">
</td>
<td >
<input name='massemailer_tracking_entities_location' {$tracking_entries_location_state} maxlength='128' type="text" value="{$TRACKING_ENTRIES_LOCATION}">
</td>
</tr>
<tr>
<td scope="row">
<div id="rollover">
{$MOD.LBL_CAMP_MESSAGE_COPY}&nbsp;<span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span>
<a href="#" class="rollover"><span>{$MOD.LBL_CAMP_MESSAGE_COPY_DESC}</span><img border="0" src="index.php?entryPoint=getImage&themeName={$THEME}&imageName=helpInline.gif"></a>
</div>
</td>
<td >
<input type='radio' name='massemailer_email_copy' value="1" {$yes_checked}>
{$MOD.LBL_YES}&nbsp;<input type='radio' {$no_checked} name='massemailer_email_copy' value="2">{$MOD.LBL_NO}
</td>
</tr>
</table>
</td>
</tr>
</table>
<div style="padding-top:2px;">
<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" class="button" onclick="this.form.action.value='Save';return verify_data(this);" type="submit" name="button" value=" {$APP.LBL_SAVE_BUTTON_LABEL} ">
<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" class="button" onclick="this.form.action.value='{$RETURN_ACTION}'; this.form.module.value='{$RETURN_MODULE}';" type="submit" name="button" value=" {$APP.LBL_CANCEL_BUTTON_LABEL} ">
</div>
</form>
{$JAVASCRIPT}

707
modules/EmailMan/tpls/config.tpl Executable file
View File

@@ -0,0 +1,707 @@
<!--
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
********************************************************************************/
-->
<!-- BEGIN: main -->
<script type="text/javascript" src="{sugar_getjspath file='modules/Users/User.js'}"></script>
<script type='text/javascript' src="{sugar_getjspath file='include/javascript/sugar_grp_overlib.js'}"></script>
<script type="text/javascript" src="{sugar_getjspath file='include/javascript/sugar_grp_yui_widgets.js'}"></script>
{literal}
<script type="text/javascript" >
<!--
function change_state(radiobutton) {
if (radiobutton.value == '1') {
radiobutton.form['massemailer_tracking_entities_location'].disabled=true;
radiobutton.form['massemailer_tracking_entities_location'].value='{/literal}{$MOD.TRACKING_ENTRIES_LOCATION_DEFAULT_VALUE}{literal}';
} else {
radiobutton.form['massemailer_tracking_entities_location'].disabled=false;
radiobutton.form['massemailer_tracking_entities_location'].value=null;
}
}
-->
</script>
{/literal}
{$ROLLOVER}
<form name="ConfigureSettings" id="EditView" method="POST" >
<input type="hidden" name="module" value="EmailMan">
<input type="hidden" name="action">
<input type="hidden" name="return_module" value="{$RETURN_MODULE}">
<input type="hidden" name="return_action" value="{$RETURN_ACTION}">
<input type="hidden" name="source_form" value="config" />
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td>
<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="button" onclick="this.form.action.value='Save';return verify_data(this);" type="submit" name="button" value=" {$APP.LBL_SAVE_BUTTON_LABEL} ">
<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" accessKey="{$APP.LBL_CANCEL_BUTTON_KEY}" class="button" onclick="this.form.action.value='{$RETURN_ACTION}'; this.form.module.value='{$RETURN_MODULE}';" type="submit" name="button" value=" {$APP.LBL_CANCEL_BUTTON_LABEL} ">
</td>
<td align="right" nowrap>
<span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span> {$APP.NTC_REQUIRED}
</td>
</tr>
</table>
<table width="100%" border="1" cellspacing="0" cellpadding="0" class="edit view">
<tr><td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><th align="left" scope="row" colspan="4"><h4>{$MOD.LBL_EMAIL_OUTBOUND_CONFIGURATION}</h4></th>
</tr>
<tr>
<td align="left" scope="row" colspan="4">
{$MOD.LBL_OUTGOING_SECTION_HELP}
<br />&nbsp;
</td>
</tr>
<tr class="{$OUTBOUND_TYPE_CLASS}">
<td width="20%" scope="row">{$MOD.LBL_MAIL_SENDTYPE}</td>
<td width="30%">
<select id="mail_sendtype" name="mail_sendtype" onChange="notify_setrequired(document.ConfigureSettings); SUGAR.user.showHideGmailDefaultLink(this);" tabindex="1">{$mail_sendtype_options}</select>
</td>
<td scope="row">&nbsp;</td>
<td >&nbsp;</td>
</tr>
<tr>
<td width="20%" scope="row">{$MOD.LBL_NOTIFY_FROMNAME} <span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span></td>
<td width="30%" > <input id='notify_fromname' name='notify_fromname' tabindex='1' size='25' maxlength='128' type="text" value="{$notify_fromname}"></td>
</tr>
<tr>
<td width="20%" scope="row">{$MOD.LBL_NOTIFY_FROMADDRESS} <span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span></td>
<td width="30%"><input id='notify_fromaddress' name='notify_fromaddress' tabindex='1' size='25' maxlength='128' type="text" value="{$notify_fromaddress}"></td>
</tr>
<tr>
<td align="left" scope="row" colspan="4">{$MOD.LBL_CHOOSE_EMAIL_PROVIDER}</td>
</tr>
<tr>
<td colspan="4">
<div id="smtpButtonGroup" class="yui-buttongroup">
<span id="gmail" class="yui-button yui-radio-button{if $mail_smtptype == 'gmail'} yui-button-checked{/if}">
<span class="first-child">
<button type="button" name="mail_smtptype" value="gmail">
&nbsp;&nbsp;&nbsp;&nbsp;{$APP.LBL_SMTPTYPE_GMAIL}&nbsp;&nbsp;&nbsp;&nbsp;
</button>
</span>
</span>
<span id="yahoomail" class="yui-button yui-radio-button{if $mail_smtptype == 'yahoomail'} yui-button-checked{/if}">
<span class="first-child">
<button type="button" name="mail_smtptype" value="yahoomail">
&nbsp;&nbsp;&nbsp;&nbsp;{$APP.LBL_SMTPTYPE_YAHOO}&nbsp;&nbsp;&nbsp;&nbsp;
</button>
</span>
</span>
<span id="exchange" class="yui-button yui-radio-button{if $mail_smtptype == 'exchange'} yui-button-checked{/if}">
<span class="first-child">
<button type="button" name="mail_smtptype" value="exchange">
&nbsp;&nbsp;&nbsp;&nbsp;{$APP.LBL_SMTPTYPE_EXCHANGE}&nbsp;&nbsp;&nbsp;&nbsp;
</button>
</span>
</span>
<span id="other" class="yui-button yui-radio-button{if $mail_smtptype == 'other' || empty($mail_smtptype)} yui-button-checked{/if}">
<span class="first-child">
<button type="button" name="mail_smtptype" value="other">
&nbsp;&nbsp;&nbsp;&nbsp;{$APP.LBL_TABGROUP_OTHER}&nbsp;&nbsp;&nbsp;&nbsp;
</button>
</span>
</span>
</div>
</td>
</tr>
<tr>
<td colspan="4">
<div id="smtp_settings">
<table width="100%" cellpadding="0" cellspacing="0">
<tr id="mailsettings1">
<td width="20%" scope="row"><span id="mail_smtpserver_label">{$MOD.LBL_MAIL_SMTPSERVER}</span> <span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span></td>
<td width="30%" ><input type="text" id="mail_smtpserver" name="mail_smtpserver" tabindex="1" size="25" maxlength="64" value="{$mail_smtpserver}"></td>
<td width="20%" scope="row"><span id="mail_smtpport_label">{$MOD.LBL_MAIL_SMTPPORT}</span> <span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span></td>
<td width="30%" ><input type="text" id="mail_smtpport" name="mail_smtpport" tabindex="1" size="5" maxlength="5" value="{$mail_smtpport}"></td>
</tr>
<tr id="mailsettings2">
<td scope="row"><span id='mail_smtpauth_req_label'>{$MOD.LBL_MAIL_SMTPAUTH_REQ}</span></td>
<td >
<input id='mail_smtpauth_req' name='mail_smtpauth_req' type="checkbox" class="checkbox" value="1" tabindex='1'
onclick="notify_setrequired(document.ConfigureSettings);" {$mail_smtpauth_req}>
</td>
<td width="15%" scope="row"><span id="mail_smtpssl_label">{$APP.LBL_EMAIL_SMTP_SSL_OR_TLS}</span></td>
<td width="35%" >
<select id="mail_smtpssl" name="mail_smtpssl" tabindex="501">{$MAIL_SSL_OPTIONS}</select>
</td>
</tr>
<tr id="smtp_auth1">
<td width="20%" scope="row"><span id="mail_smtpuser_label">{$MOD.LBL_MAIL_SMTPUSER}</span> <span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span></td>
<td width="30%" ><input type="text" id="mail_smtpuser" name="mail_smtpuser" size="25" maxlength="64" value="{$mail_smtpuser}" tabindex='1' ></td>
<td width="20%">&nbsp;</td>
<td width="30%">&nbsp;</td>
</tr>
<tr id="smtp_auth2">
<td width="20%" scope="row"><span id="mail_smtppass_label">{$MOD.LBL_MAIL_SMTPPASS}</span> <span class="required">{$APP.LBL_REQUIRED_SYMBOL}</span></td>
<td width="30%" ><input type="password" id="mail_smtppass" name="mail_smtppass" size="25" maxlength="64" value="{$mail_smtppass}" tabindex='1'></td>
<td width="20%">&nbsp;</td>
<td width="30%">&nbsp;</td>
</tr>
<tr id="mail_allow_user">
<td width="20%" scope="row">
{$MOD.LBL_ALLOW_DEFAULT_SELECTION}&nbsp;
<img border="0" onmouseout="return nd();" onmouseover="return overlib('{$MOD.LBL_ALLOW_DEFAULT_SELECTION_HELP}', FGCLASS, 'olFgClass', CGCLASS, 'olCgClass', BGCLASS, 'olBgClass', TEXTFONTCLASS, 'olFontClass', CAPTIONFONTCLASS, 'olCapFontClass', CLOSEFONTCLASS, 'olCloseFontClass', WIDTH, -1, NOFOLLOW, 'ol_nofollow')" src="index.php?entryPoint=getImage&themeName={$THEME}&imageName=helpInline.gif">
</td>
<td width="30%">
<input type='hidden' name='notify_allow_default_outbound' value='0'>
<input name='notify_allow_default_outbound' value="2" tabindex='1' class="checkbox" type="checkbox" {$notify_allow_default_outbound_on}>
</td>
<td width="20%">&nbsp;</td>
<td width="30%">&nbsp;</td>
</tr>
</table>
</div>
</td>
</tr>
<tr><td colspan="4">&nbsp;</tr>
<tr>
<td width="15%"><input type="button" class="button" value="{$APP.LBL_EMAIL_TEST_OUTBOUND_SETTINGS}" onclick="testOutboundSettings();">&nbsp;</td>
<td width="15%">&nbsp;</td>
<td width="40%">&nbsp;</td>
<td width="40%">&nbsp;</td>
</tr>
</table>
</td></tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="edit view">
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<th align="left" scope="row" colspan="4">
<h4>{$MOD.LBL_NOTIFY_TITLE}</h4>
</th>
</tr>
<tr>
<td width="20%" scope="row" valign='top'>
{$MOD.LBL_NOTIFY_ON}:&nbsp;
<img border="0" onmouseout="return nd();" onmouseover="return overlib('{$MOD.LBL_NOTIFICATION_ON_DESC}', FGCLASS, 'olFgClass', CGCLASS, 'olCgClass', BGCLASS, 'olBgClass', TEXTFONTCLASS, 'olFontClass', CAPTIONFONTCLASS, 'olCapFontClass', CLOSEFONTCLASS, 'olCloseFontClass', WIDTH, -1, NOFOLLOW, 'ol_nofollow')" src="index.php?entryPoint=getImage&themeName={$THEME}&imageName=helpInline.gif">
</td>
<td width="30%" valign='top'>
<input type='hidden' name='notify_on' value='0'><input name="notify_on" tabindex='1' value="1" class="checkbox" type="checkbox" {$notify_on}>
</td>
<td scope="row" width="17%"></td>
<td></td>
</tr>
<tr>
<td width="20%" scope="row" valign='top'>
{$MOD.LBL_EMAIL_DEFAULT_DELETE_ATTACHMENTS}:&nbsp;
</td>
<td width="30%" valign='top'>
<input type='checkbox' name='email_default_delete_attachments' value="1" {$DEFAULT_EMAIL_DELETE_ATTACHMENTS}>
</td>
<td scope="row" width="20%">{$MOD.LBL_NOTIFY_SEND_FROM_ASSIGNING_USER}:</td>
<td width="30%" valign='top'><input type='hidden' name='notify_send_from_assigning_user' value='0'><input name='notify_send_from_assigning_user' value="2" tabindex='1' class="checkbox" type="checkbox" {$notify_send_from_assigning_user}></td>
</tr>
<tr>
<td colspan='4' scope="row">&nbsp;</td>
</tr>
</table>
</td></tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="edit view">
<tr><td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<th align="left" scope="row" colspan="4"><h4>{$MOD.LBL_SECURITY_TITLE}</h4></th>
</tr>
<tr>
<td align="left" scope="row" colspan="4">
{$MOD.LBL_SECURITY_DESC}
<br />&nbsp;
</td>
</tr>
<tr>
<td width="10%" NOWRAP scope="row" valign="top" >
<input type="checkbox" value="1" name="set_outlook_defaults" id="set_outlook_defaults" onclick="setOutlookDefaults();">&nbsp;
{literal}
<script type="text/javascript" language="Javascript">
<!--
function toggleAllSecurityOptions() {
document.getElementById('set_outlook_defaults').checked = false;
var check = false;
if(document.getElementById('toggle_all').checked == true) {
check = true;
}
document.getElementById('applet').checked = check;
document.getElementById('base').checked = check;
document.getElementById('embed').checked = check;
document.getElementById('form').checked = check;
document.getElementById('frame').checked = check;
document.getElementById('frameset').checked = check;
document.getElementById('iframe').checked = check;
document.getElementById('import').checked = check;
document.getElementById('layer').checked = check;
document.getElementById('link').checked = check;
document.getElementById('object').checked = check;
document.getElementById('style').checked = check;
document.getElementById('xmp').checked = check;
}
function setOutlookDefaults() {
document.getElementById('toggle_all').checked = false;
document.getElementById('applet').checked = true;
document.getElementById('base').checked = true;
document.getElementById('embed').checked = true;
document.getElementById('form').checked = true;
document.getElementById('frame').checked = true;
document.getElementById('frameset').checked = true;
document.getElementById('iframe').checked = true;
document.getElementById('import').checked = true;
document.getElementById('layer').checked = true;
document.getElementById('link').checked = true;
document.getElementById('object').checked = true;
document.getElementById('style').checked = false;
document.getElementById('xmp').checked = true;
}
-->
</script>
{/literal}
</td>
<td valign="middle" valign="top" scope="row" colspan="3">
{$MOD.LBL_SECURITY_OUTLOOK_DEFAULTS}
</td>
</tr>
<tr>
<td colspan="4">&nbsp;</td>
</tr>
<tr>
<td width="10%" NOWRAP scope="row" valign="top" >
<input type="checkbox" value="1" name="toggle_all" id="toggle_all" onclick="toggleAllSecurityOptions();">&nbsp;
</td>
<td valign="middle" valign="top" scope="row" colspan="3">
{$MOD.LBL_SECURITY_TOGGLE_ALL}
</td>
</tr>
<tr>
<td colspan="4">&nbsp;</td>
</tr>
<tr>
<td width="10%" NOWRAP scope="row" valign="middle" >
<input type="checkbox" value="1" name="applet" id="applet" {$appletChecked}>&nbsp; &lt;applet&gt;
</td>
<td width="40%" valign="middle" scope="row">
{$MOD.LBL_SECURITY_APPLET}
</td>
<td width="10%" NOWRAP scope="row" valign="middle" >
<input type="checkbox" value="1" name="base" id="base" {$baseChecked}>&nbsp; &lt;base&gt;
</td>
<td width="40%" valign="middle" scope="row">
{$MOD.LBL_SECURITY_BASE}
</td>
</tr>
<tr>
<td width="10%" NOWRAP scope="row" valign="middle" >
<input type="checkbox" value="1" name="embed" id="embed" {$embedChecked}>&nbsp; &lt;embed&gt;
</td>
<td width="40%" valign="middle" scope="row">
{$MOD.LBL_SECURITY_EMBED}
</td>
<td width="10%" NOWRAP scope="row" valign="middle" >
<input type="checkbox" value="1" name="form" id="form" {$formChecked}>&nbsp; &lt;form&gt;
</td>
<td width="40%" valign="middle" scope="row">
{$MOD.LBL_SECURITY_FORM}
</td>
</tr>
<tr>
<td width="10%" NOWRAP scope="row" valign="middle" >
<input type="checkbox" value="1" name="frame" id="frame" {$frameChecked}>&nbsp; &lt;frame&gt;
</td>
<td width="40%" valign="middle" scope="row">
{$MOD.LBL_SECURITY_FRAME}
</td>
<td width="10%" NOWRAP scope="row" valign="middle" >
<input type="checkbox" value="1" name="frameset" id="frameset" {$framesetChecked}>&nbsp; &lt;frameset&gt;
</td>
<td width="40%" valign="middle" scope="row">
{$MOD.LBL_SECURITY_FRAMESET}
</td>
</tr>
<tr>
<td width="10%" NOWRAP scope="row" valign="middle" >
<input type="checkbox" value="1" name="iframe" id="iframe" {$iframeChecked}>&nbsp; &lt;iframe&gt;
</td>
<td width="40%" valign="middle" scope="row">
{$MOD.LBL_SECURITY_IFRAME}
</td>
<td width="10%" NOWRAP scope="row" valign="middle" >
<input type="checkbox" value="1" name="import" id="import" {$importChecked}>&nbsp; &lt;import&gt;
</td>
<td width="40%" valign="middle" scope="row">
{$MOD.LBL_SECURITY_IMPORT}
</td>
</tr>
<tr>
<td width="10%" NOWRAP scope="row" valign="middle" >
<input type="checkbox" value="1" name="layer" id="layer" {$layerChecked}>&nbsp; &lt;layer&gt;
</td>
<td width="40%" valign="middle" scope="row">
{$MOD.LBL_SECURITY_LAYER}
</td>
<td width="10%" NOWRAP scope="row" valign="middle" >
<input type="checkbox" value="1" name="link" id="link" {$linkChecked}>&nbsp; &lt;link&gt;
</td>
<td width="40%" valign="middle" scope="row">
{$MOD.LBL_SECURITY_LINK}
</td>
</tr>
<tr>
<td width="10%" NOWRAP scope="row" valign="middle" >
<input type="checkbox" value="1" name="object" id="object" {$objectChecked}>&nbsp; &lt;object&gt;
</td>
<td width="40%" valign="middle" scope="row">
{$MOD.LBL_SECURITY_OBJECT}
</td>
<td width="10%" NOWRAP scope="row" valign="middle" >
<input type="checkbox" value="1" name="style" id="style" {$styleChecked}>&nbsp; &lt;style&gt;
</td>
<td width="40%" valign="middle" scope="row">
{$MOD.LBL_SECURITY_STYLE}
</td>
</tr>
<tr>
<td width="10%" NOWRAP scope="row" valign="middle" >
<input type="checkbox" value="1" name="xmp" id="xmp" {$xmpChecked}>&nbsp; &lt;xmp&gt;
</td>
<td width="40%" valign="middle" scope="row">
{$MOD.LBL_SECURITY_XMP}
</td>
<td></td>
<td></td>
</table>
</td></tr>
</table>
</td>
</tr>
</table>
<div id="testOutboundDialog" class="yui-hidden">
<div id="testOutbound">
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="edit view">
<tr>
<td scope="row">
{$APP.LBL_EMAIL_SETTINGS_FROM_TO_EMAIL_ADDR}
<span class="required">
{$APP.LBL_REQUIRED_SYMBOL}
</span>
</td>
<td >
<input type="text" id="outboundtest_from_address" name="outboundtest_from_address" size="35" maxlength="64" value="{$CURRENT_USER_EMAIL}">
</td>
</tr>
<tr>
<td scope="row" colspan="2">
<input type="button" class="button" value=" {$APP.LBL_EMAIL_SEND} " onclick="javascript:sendTestEmail();">&nbsp;
<input type="button" class="button" value=" {$APP.LBL_CANCEL_BUTTON_LABEL} " onclick="javascript:EmailMan.testOutboundDialog.hide();">&nbsp;
</td>
</tr>
</table>
</div>
</div>
<div style="padding-top:2px;">
<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" class="button" onclick="this.form.action.value='Save';return verify_data(this);" type="submit" name="button" value=" {$APP.LBL_SAVE_BUTTON_LABEL} ">
<input title="{$APP.LBL_CANCEL_BUTTON_TITLE}" class="button" onclick="this.form.action.value='{$RETURN_ACTION}'; this.form.module.value='{$RETURN_MODULE}';" type="submit" name="button" value=" {$APP.LBL_CANCEL_BUTTON_LABEL} ">
</div>
</form>
{$JAVASCRIPT}
{literal}
<script type="text/javascript">
<!--
var loader = new YAHOO.util.YUILoader({
require : ["element","sugarwidgets"],
loadOptional: true,
skin: { base: 'blank', defaultSkin: '' },
allowRollup: true,
base: "include/javascript/yui/build/"
});
loader.addModule({
name :"sugarwidgets",
type : "js",
fullpath: "include/javascript/sugarwidgets/SugarYUIWidgets.js",
varName: "YAHOO.SUGAR",
requires: ["datatable", "dragdrop", "treeview", "tabview"]
});
loader.insert();
EmailMan = {};
function testOutboundSettings() {
if (document.getElementById('mail_sendtype').value == 'sendmail') {
testOutboundSettingsDialog();
return;
}
var errorMessage = '';
var isError = false;
var fromAddress = document.getElementById("outboundtest_from_address").value;
var errorMessage = '';
var isError = false;
var smtpServer = document.getElementById('mail_smtpserver').value;
var smtpPort = document.getElementById('mail_smtpport').value;
var smtpssl = document.getElementById('mail_smtpssl').value;
var mailsmtpauthreq = document.getElementById('mail_smtpauth_req');
if(trim(smtpServer) == '') {
isError = true;
errorMessage += "{/literal}{$APP.LBL_EMAIL_ACCOUNTS_SMTPSERVER}{literal}" + "<br/>";
}
if(trim(smtpPort) == '') {
isError = true;
errorMessage += "{/literal}{$APP.LBL_EMAIL_ACCOUNTS_SMTPPORT}{literal}" + "<br/>";
}
if(mailsmtpauthreq.checked) {
if(trim(document.getElementById('mail_smtpuser').value) == '') {
isError = true;
errorMessage += "{/literal}{$APP.LBL_EMAIL_ACCOUNTS_SMTPUSER}{literal}" + "<br/>";
}
if(trim(document.getElementById('mail_smtppass').value) == '') {
isError = true;
errorMessage += "{/literal}{$APP.LBL_EMAIL_ACCOUNTS_SMTPPASS}{literal}" + "<br/>";
}
}
if(isError) {
overlay("{/literal}{$APP.ERR_MISSING_REQUIRED_FIELDS}{literal}", errorMessage, 'alert');
return false;
}
testOutboundSettingsDialog();
}
function sendTestEmail()
{
var toAddress = document.getElementById("outboundtest_from_address").value;
var fromAddress = document.getElementById("notify_fromaddress").value;
if (trim(toAddress) == "")
{
overlay("{/literal}{$APP.ERR_MISSING_REQUIRED_FIELDS}{literal}", "{/literal}{$APP.LBL_EMAIL_SETTINGS_FROM_TO_EMAIL_ADDR}{literal}", 'alert');
return;
}
else if (!isValidEmail(toAddress)) {
overlay("{/literal}{$APP.ERR_INVALID_REQUIRED_FIELDS}{literal}", "{/literal}{$APP.LBL_EMAIL_SETTINGS_FROM_TO_EMAIL_ADDR}{literal}", 'alert');
return;
}
if (trim(fromAddress) == "")
{
overlay("{/literal}{$APP.ERR_MISSING_REQUIRED_FIELDS}{literal}", "{/literal}{$APP.LBL_EMAIL_SETTINGS_FROM_ADDR}{literal}", 'alert');
return;
}
else if (!isValidEmail(fromAddress)) {
overlay("{/literal}{$APP.ERR_INVALID_REQUIRED_FIELDS}{literal}", "{/literal}{$APP.LBL_EMAIL_SETTINGS_FROM_ADDR}{literal}", 'alert');
return;
}
//Hide the email address window and show a message notifying the user that the test email is being sent.
EmailMan.testOutboundDialog.hide();
overlay("{/literal}{$APP.LBL_EMAIL_PERFORMING_TASK}{literal}", "{/literal}{$APP.LBL_EMAIL_ONE_MOMENT}{literal}", 'alert');
var callbackOutboundTest = {
success : function(o) {
hideOverlay();
overlay("{/literal}{$APP.LBL_EMAIL_TEST_OUTBOUND_SETTINGS}{literal}", "{/literal}{$APP.LBL_EMAIL_TEST_NOTIFICATION_SENT}{literal}", 'alert');
}
};
var smtpServer = document.getElementById('mail_smtpserver').value;
var smtpPort = document.getElementById('mail_smtpport').value;
var smtpssl = document.getElementById('mail_smtpssl').value;
var mailsmtpauthreq = document.getElementById('mail_smtpauth_req');
var mail_sendtype = document.getElementById('mail_sendtype').value;
var postDataString = 'mail_sendtype=' + mail_sendtype + '&mail_smtpserver=' + smtpServer + "&mail_smtpport=" + smtpPort + "&mail_smtpssl=" + smtpssl +
"&mail_smtpauth_req=" + mailsmtpauthreq.checked + "&mail_smtpuser=" + trim(document.getElementById('mail_smtpuser').value) +
"&mail_smtppass=" + trim(document.getElementById('mail_smtppass').value) + "&outboundtest_to_address=" + toAddress + "&outboundtest_from_address=" + fromAddress;
YAHOO.util.Connect.asyncRequest("POST", "index.php?action=testOutboundEmail&module=EmailMan&to_pdf=true&sugar_body_only=true", callbackOutboundTest, postDataString);
}
function testOutboundSettingsDialog() {
// lazy load dialogue
if(!EmailMan.testOutboundDialog) {
EmailMan.testOutboundDialog = new YAHOO.widget.Dialog("testOutboundDialog", {
modal:true,
visible:true,
fixedcenter:true,
constraintoviewport: true,
width : 600,
shadow : false
});
EmailMan.testOutboundDialog.setHeader("{/literal}{$APP.LBL_EMAIL_TEST_OUTBOUND_SETTINGS}{literal}");
YAHOO.util.Dom.removeClass("testOutboundDialog", "yui-hidden");
} // end lazy load
EmailMan.testOutboundDialog.render();
EmailMan.testOutboundDialog.show();
} // fn
function overlay(reqtitle, body, type) {
var config = { };
config.type = type;
config.title = reqtitle;
config.msg = body;
YAHOO.SUGAR.MessageBox.show(config);
}
function hideOverlay() {
YAHOO.SUGAR.MessageBox.hide();
}
function notify_setrequired(f) {
document.getElementById("smtp_settings").style.display = (f.mail_sendtype.value == "SMTP") ? "inline" : "none";
document.getElementById("smtp_settings").style.visibility = (f.mail_sendtype.value == "SMTP") ? "visible" : "hidden";
document.getElementById("smtp_auth1").style.display = (document.getElementById('mail_smtpauth_req').checked) ? "" : "none";
document.getElementById("smtp_auth1").style.visibility = (document.getElementById('mail_smtpauth_req').checked) ? "visible" : "hidden";
document.getElementById("smtp_auth2").style.display = (document.getElementById('mail_smtpauth_req').checked) ? "" : "none";
document.getElementById("smtp_auth2").style.visibility = (document.getElementById('mail_smtpauth_req').checked) ? "visible" : "hidden";
if( document.getElementById('mail_smtpauth_req').checked)
YAHOO.util.Dom.removeClass('mail_allow_user', "yui-hidden");
else
YAHOO.util.Dom.addClass("mail_allow_user", "yui-hidden");
return true;
}
/**
* If the outlook options are all set on page load then enable the outlook field so that the user has an indication
* that that filter has been applied.
*/
function setOutlookDefault()
{
var shouldToggle = true;
var aCheckFields = ['applet','base', 'embed','form','frame','frameset', 'iframe','import','layer','link', 'object', 'xmp'];
for(var i=0;i<aCheckFields.length;i++)
{
var tmpName = aCheckFields[i];
if( ! document.getElementById(tmpName).checked )
{
shouldToggle = false;
break;
}
}
if(shouldToggle && !document.getElementById('style').checked)
document.getElementById('set_outlook_defaults').checked = true;
}
YAHOO.util.Event.onDOMReady(setOutlookDefault);
notify_setrequired(document.ConfigureSettings);
function changeEmailScreenDisplay(smtptype, clear)
{
if(clear) {
document.getElementById("mail_smtpserver").value = '';
document.getElementById("mail_smtpport").value = '25';
document.getElementById("mail_smtpauth_req").checked = true;
document.getElementById("mailsettings1").style.display = '';
document.getElementById("mailsettings2").style.display = '';
document.getElementById("mail_smtppass_label").innerHTML = '{/literal}{$MOD.LBL_MAIL_SMTPPASS}{literal}';
document.getElementById("mail_smtpport_label").innerHTML = '{/literal}{$MOD.LBL_MAIL_SMTPPORT}{literal}';
document.getElementById("mail_smtpserver_label").innerHTML = '{/literal}{$MOD.LBL_MAIL_SMTPSERVER}{literal}';
document.getElementById("mail_smtpuser_label").innerHTML = '{/literal}{$MOD.LBL_MAIL_SMTPUSER}{literal}';
}
switch (smtptype) {
case "yahoomail":
document.getElementById("mail_smtpserver").value = 'plus.smtp.mail.yahoo.com';
document.getElementById("mail_smtpport").value = '465';
document.getElementById("mail_smtpauth_req").checked = true;
var ssl = document.getElementById("mail_smtpssl");
for(var j=0;j<ssl.options.length;j++) {
if(ssl.options[j].text == 'SSL') {
ssl.options[j].selected = true;
break;
}
}
document.getElementById("mailsettings1").style.display = 'none';
document.getElementById("mailsettings2").style.display = 'none';
document.getElementById("mail_smtppass_label").innerHTML =
document.getElementById("mail_smtppass_label").innerHTML = '{/literal}{$MOD.LBL_YAHOOMAIL_SMTPPASS}{literal}';
document.getElementById("mail_smtpuser_label").innerHTML = '{/literal}{$MOD.LBL_YAHOOMAIL_SMTPUSER}{literal}';
break;
case "gmail":
document.getElementById("mail_smtpserver").value = 'smtp.gmail.com';
document.getElementById("mail_smtpport").value = '587';
document.getElementById("mail_smtpauth_req").checked = true;
var ssl = document.getElementById("mail_smtpssl");
for(var j=0;j<ssl.options.length;j++) {
if(ssl.options[j].text == 'TLS') {
ssl.options[j].selected = true;
break;
}
}
document.getElementById("mailsettings1").style.display = 'none';
document.getElementById("mailsettings2").style.display = 'none';
document.getElementById("mail_smtppass_label").innerHTML = '{/literal}{$MOD.LBL_GMAIL_SMTPPASS}{literal}';
document.getElementById("mail_smtpuser_label").innerHTML = '{/literal}{$MOD.LBL_GMAIL_SMTPUSER}{literal}';
break;
case "exchange":
if ( document.getElementById("mail_smtpserver").value == 'plus.smtp.mail.yahoo.com'
|| document.getElementById("mail_smtpserver").value == 'smtp.gmail.com' ) {
document.getElementById("mail_smtpserver").value = '';
}
document.getElementById("mail_smtpport").value = '25';
document.getElementById("mail_smtpauth_req").checked = true;
document.getElementById("mailsettings1").style.display = '';
document.getElementById("mailsettings2").style.display = '';
document.getElementById("mail_smtppass_label").innerHTML = '{/literal}{$MOD.LBL_EXCHANGE_SMTPPASS}{literal}';
document.getElementById("mail_smtpport_label").innerHTML = '{/literal}{$MOD.LBL_EXCHANGE_SMTPPORT}{literal}';
document.getElementById("mail_smtpserver_label").innerHTML = '{/literal}{$MOD.LBL_EXCHANGE_SMTPSERVER}{literal}';
document.getElementById("mail_smtpuser_label").innerHTML = '{/literal}{$MOD.LBL_EXCHANGE_SMTPUSER}{literal}';
break;
}
notify_setrequired(document.ConfigureSettings);
}
var oButtonGroup = new YAHOO.widget.ButtonGroup("smtpButtonGroup");
oButtonGroup.subscribe('checkedButtonChange', function(e)
{
changeEmailScreenDisplay(e.newValue.get('value'), true);
document.getElementById('smtp_settings').style.display = '';
document.getElementById('EditView').mail_smtptype.value = e.newValue.get('value');
});
YAHOO.widget.Button.addHiddenFieldsToForm(document.ConfigureSettings);
{/literal}{if !empty($mail_smtptype)}{literal}
changeEmailScreenDisplay("{/literal}{$mail_smtptype}{literal}", false);
{/literal}{/if}{literal}
-->
</script>
{/literal}

175
modules/EmailMan/vardefs.php Executable file
View File

@@ -0,0 +1,175 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
$dictionary['EmailMan'] =
array( 'table' => 'emailman', 'comment' => 'Email campaign queue', 'fields' => array(
'date_entered' => array(
'name' => 'date_entered',
'vname' => 'LBL_DATE_ENTERED',
'type' => 'datetime',
'comment' => 'Date record created',
),
'date_modified' => array(
'name' => 'date_modified',
'vname' => 'LBL_DATE_MODIFIED',
'type' => 'datetime',
'comment' => 'Date record last modified',
),
'user_id' => array(
'name' => 'user_id',
'vname' => 'LBL_USER_ID',
'type' => 'id','len' => '36',
'reportable' =>false,
'comment' => 'User ID representing assigned-to user',
),
'id' =>
array (
'name' => 'id',
'vname' => 'LBL_ID',
'type' => 'int',
'len' => '11',
'auto_increment'=>true,
'comment' => 'Unique identifier',
),
'campaign_id' => array(
'name' => 'campaign_id',
'vname' => 'LBL_CAMPAIGN_ID',
'type' => 'id',
'reportable' =>false,
'comment' => 'ID of related campaign',
),
'marketing_id' => array(
'name' => 'marketing_id',
'vname' => 'LBL_MARKETING_ID',
'type' => 'id',
'reportable' =>false,
'comment' => '',
),
'list_id' => array(
'name' => 'list_id',
'vname' => 'LBL_LIST_ID',
'type' => 'id',
'reportable' =>false,
'len' => '36',
'comment' => 'Associated list',
),
'send_date_time' => array(
'name' => 'send_date_time' ,
'vname' => 'LBL_SEND_DATE_TIME',
'type' => 'datetime',
),
'modified_user_id' => array(
'name' => 'modified_user_id',
'vname' => 'LBL_MODIFIED_USER_ID',
'type' => 'id',
'reportable' =>false,
'len' => '36',
'comment' => 'User ID who last modified record',
),
'in_queue' => array(
'name' => 'in_queue',
'vname' => 'LBL_IN_QUEUE',
'type' => 'bool',
'comment' => 'Flag indicating if item still in queue',
),
'in_queue_date' => array(
'name' => 'in_queue_date',
'vname' => 'LBL_IN_QUEUE_DATE',
'type' => 'datetime',
'comment' => 'Datetime in which item entered queue',
),
'send_attempts' => array(
'name' => 'send_attempts',
'vname' => 'LBL_SEND_ATTEMPTS',
'type' => 'int',
'default' => '0',
'comment' => 'Number of attempts made to send this item',
),
'deleted' => array(
'name' => 'deleted',
'vname' => 'LBL_DELETED',
'type' => 'bool',
'reportable' =>false,
'comment' => 'Record deletion indicator',
),
'related_id' => array(
'name' => 'related_id',
'vname' => 'LBL_RELATED_ID',
'type' => 'id',
'reportable' =>false,
'comment' => 'ID of Sugar object to which this item is related',
),
'related_type' => array(
'name' => 'related_type' ,
'vname' => 'LBL_RELATED_TYPE',
'type' => 'varchar',
'len' => '100',
'comment' => 'Descriptor of the Sugar object indicated by related_id',
),
'recipient_name' => array(
'name' => 'recipient_name',
'type' => 'varchar',
'len' => '255',
'source'=>'non-db',
),
'recipient_email' => array(
'name' => 'recipient_email',
'type' => 'varchar',
'len' => '255',
'source'=>'non-db',
),
'message_name' => array(
'name' => 'message_name',
'type' => 'varchar',
'len' => '255',
'source'=>'non-db',
),
'campaign_name' => array(
'name' => 'campaign_name',
'vname' => 'LBL_LIST_CAMPAIGN',
'type' => 'varchar',
'len' => '50',
'source'=>'non-db',
),
), 'indices' => array (
array('name' => 'emailmanpk', 'type' => 'primary', 'fields' => array('id')),
array('name' => 'idx_eman_list', 'type' => 'index', 'fields' => array('list_id','user_id','deleted')),
array('name' => 'idx_eman_campaign_id', 'type' => 'index', 'fields' => array('campaign_id')),
array('name' => 'idx_eman_relid_reltype_id', 'type' => 'index', 'fields'=> array('related_id', 'related_type', 'campaign_id')),
)
);
?>

View File

@@ -0,0 +1,129 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: TODO: To be written.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
require_once('include/MVC/View/SugarView.php');
require_once('modules/EmailMan/Forms.php');
class ViewCampaignconfig extends SugarView
{
/**
* @see SugarView::_getModuleTitleParams()
*/
protected function _getModuleTitleParams()
{
global $mod_strings;
return array(
"<a href='index.php?module=Administration&action=index'>".translate('LBL_MODULE_NAME','Administration')."</a>",
$mod_strings['LBL_CONFIGURE_CAMPAIGN_EMAIL_SETTINGS'],
);
}
/**
* @see SugarView::preDisplay()
*/
public function preDisplay()
{
global $current_user;
if ( !is_admin($current_user)
&& !is_admin_for_module($GLOBALS['current_user'],'Campaigns') )
sugar_die("Unauthorized access to administration.");
}
/**
* @see SugarView::display()
*/
public function display()
{
global $mod_strings;
global $app_list_strings;
global $app_strings;
global $current_user;
echo $this->getModuleTitle();
global $currentModule;
$focus = new Administration();
$focus->retrieveSettings(); //retrieve all admin settings.
$GLOBALS['log']->info("Mass Emailer(EmailMan) ConfigureSettings view");
$this->ss->assign("MOD", $mod_strings);
$this->ss->assign("APP", $app_strings);
$this->ss->assign("THEME", SugarThemeRegistry::current()->__toString());
$this->ss->assign("RETURN_MODULE", "Administration");
$this->ss->assign("RETURN_ACTION", "index");
$this->ss->assign("MODULE", $currentModule);
$this->ss->assign("PRINT_URL", "index.php?".$GLOBALS['request_string']);
if (isset($focus->settings['massemailer_campaign_emails_per_run']) && !empty($focus->settings['massemailer_campaign_emails_per_run'])) {
$this->ss->assign("EMAILS_PER_RUN", $focus->settings['massemailer_campaign_emails_per_run']);
} else {
$this->ss->assign("EMAILS_PER_RUN", 500);
}
if (!isset($focus->settings['massemailer_tracking_entities_location_type']) or empty($focus->settings['massemailer_tracking_entities_location_type']) or $focus->settings['massemailer_tracking_entities_location_type']=='1') {
$this->ss->assign("default_checked", "checked");
$this->ss->assign("TRACKING_ENTRIES_LOCATION_STATE", "disabled");
$this->ss->assign("TRACKING_ENTRIES_LOCATION",$mod_strings['TRACKING_ENTRIES_LOCATION_DEFAULT_VALUE']);
} else {
$this->ss->assign("userdefined_checked", "checked");
$this->ss->assign("TRACKING_ENTRIES_LOCATION",$focus->settings["massemailer_tracking_entities_location"]);
}
// Change the default campaign to not store a copy of each message.
if (!empty($focus->settings['massemailer_email_copy']) and $focus->settings['massemailer_email_copy']=='1') {
$this->ss->assign("yes_checked", "checked='checked'");
} else {
$this->ss->assign("no_checked", "checked='checked'");
}
$email = new Email();
$this->ss->assign('ROLLOVER', $email->rolloverStyle);
$this->ss->assign("JAVASCRIPT",get_validate_record_js());
$this->ss->display("modules/EmailMan/tpls/campaignconfig.tpl");
}
}

View File

@@ -0,0 +1,182 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
/*********************************************************************************
* Description: TODO: To be written.
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
* All Rights Reserved.
* Contributor(s): ______________________________________..
********************************************************************************/
require_once('include/MVC/View/SugarView.php');
require_once('modules/EmailMan/Forms.php');
class ViewConfig extends SugarView
{
/**
* @see SugarView::_getModuleTitleParams()
*/
protected function _getModuleTitleParams()
{
global $mod_strings;
return array(
"<a href='index.php?module=Administration&action=index'>".translate('LBL_MODULE_NAME','Administration')."</a>",
$mod_strings['LBL_CONFIGURE_SETTINGS'],
);
}
/**
* @see SugarView::preDisplay()
*/
public function preDisplay()
{
global $current_user;
if ( !is_admin($current_user)
&& !is_admin_for_module($GLOBALS['current_user'],'Emails')
&& !is_admin_for_module($GLOBALS['current_user'],'Campaigns') )
sugar_die("Unauthorized access to administration.");
}
/**
* @see SugarView::display()
*/
public function display()
{
global $mod_strings;
global $app_list_strings;
global $app_strings;
global $current_user;
echo $this->getModuleTitle();
global $currentModule;
$focus = new Administration();
$focus->retrieveSettings(); //retrieve all admin settings.
$GLOBALS['log']->info("Mass Emailer(EmailMan) ConfigureSettings view");
$this->ss->assign("MOD", $mod_strings);
$this->ss->assign("APP", $app_strings);
$this->ss->assign("RETURN_MODULE", "Administration");
$this->ss->assign("RETURN_ACTION", "index");
$this->ss->assign("MODULE", $currentModule);
$this->ss->assign("PRINT_URL", "index.php?".$GLOBALS['request_string']);
$this->ss->assign("HEADER", get_module_title("EmailMan", "{MOD.LBL_CONFIGURE_SETTINGS}", true));
$this->ss->assign("notify_fromaddress", $focus->settings['notify_fromaddress']);
$this->ss->assign("notify_send_from_assigning_user", (isset($focus->settings['notify_send_from_assigning_user']) && !empty($focus->settings['notify_send_from_assigning_user'])) ? "checked='checked'" : "");
$this->ss->assign("notify_on", ($focus->settings['notify_on']) ? "checked='checked'" : "");
$this->ss->assign("notify_fromname", $focus->settings['notify_fromname']);
$this->ss->assign("notify_allow_default_outbound_on", (!empty($focus->settings['notify_allow_default_outbound']) && $focus->settings['notify_allow_default_outbound']) ? "checked='checked'" : "");
$this->ss->assign("mail_smtptype", $focus->settings['mail_smtptype']);
$this->ss->assign("mail_smtpserver", $focus->settings['mail_smtpserver']);
$this->ss->assign("mail_smtpport", $focus->settings['mail_smtpport']);
$this->ss->assign("mail_smtpuser", $focus->settings['mail_smtpuser']);
$this->ss->assign("mail_smtppass", $focus->settings['mail_smtppass']);
$this->ss->assign("mail_smtpauth_req", ($focus->settings['mail_smtpauth_req']) ? "checked='checked'" : "");
$this->ss->assign("MAIL_SSL_OPTIONS", get_select_options_with_id($app_list_strings['email_settings_for_ssl'], $focus->settings['mail_smtpssl']));
//Assign the current users email for the test send dialogue.
$this->ss->assign("CURRENT_USER_EMAIL", $current_user->email1);
$showSendMail = FALSE;
$outboundSendTypeCSSClass = "yui-hidden";
if(isset($sugar_config['allow_sendmail_outbound']) && $sugar_config['allow_sendmail_outbound'])
{
$showSendMail = TRUE;
$app_list_strings['notifymail_sendtype']['sendmail'] = 'sendmail';
$outboundSendTypeCSSClass = "";
}
$this->ss->assign("OUTBOUND_TYPE_CLASS", $outboundSendTypeCSSClass);
$this->ss->assign("mail_sendtype_options", get_select_options_with_id($app_list_strings['notifymail_sendtype'], $focus->settings['mail_sendtype']));
///////////////////////////////////////////////////////////////////////////////
//// USER EMAIL DEFAULTS
// editors
$editors = $app_list_strings['dom_email_editor_option'];
$newEditors = array();
foreach($editors as $k => $v) {
if($k != "") { $newEditors[$k] = $v; }
}
// preserve attachments
$preserveAttachments = '';
if(isset($sugar_config['email_default_delete_attachments']) && $sugar_config['email_default_delete_attachments'] == true) {
$preserveAttachments = 'CHECKED';
}
$this->ss->assign('DEFAULT_EMAIL_DELETE_ATTACHMENTS', $preserveAttachments);
//// END USER EMAIL DEFAULTS
///////////////////////////////////////////////////////////////////////////////
//setting to manage.
//emails_per_run
//tracking_entities_location_type default or custom
//tracking_entities_location http://www.sugarcrm.com/track/
//////////////////////////////////////////////////////////////////////////////
//// EMAIL SECURITY
if(!isset($sugar_config['email_xss']) || empty($sugar_config['email_xss'])) {
$sugar_config['email_xss'] = getDefaultXssTags();
}
foreach(unserialize(base64_decode($sugar_config['email_xss'])) as $k => $v) {
$this->ss->assign($k."Checked", 'CHECKED');
}
//clean_xss('here');
//// END EMAIL SECURITY
///////////////////////////////////////////////////////////////////////////////
require_once('modules/Emails/Email.php');
$email = new Email();
$this->ss->assign('ROLLOVER', $email->rolloverStyle);
$this->ss->assign("JAVASCRIPT",get_validate_record_js());
$this->ss->display('modules/EmailMan/tpls/config.tpl');
}
}

View File

@@ -0,0 +1,93 @@
<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
require_once('include/MVC/View/views/view.list.php');
class EmailManViewList extends ViewList
{
/**
* @see SugarView::preDisplay()
*/
public function preDisplay()
{
global $current_user;
if ( !is_admin($current_user) && !is_admin_for_module($current_user,'Campaigns') )
sugar_die('Admin Only Section');
$this->lv = new ListViewSmarty();
$this->lv->export = false;
$this->lv->quickViewLinks = false;
}
/**
* @see SugarView::_getModuleTitleParams()
*/
protected function _getModuleTitleParams()
{
global $mod_strings;
return array(
"<a href='index.php?module=Administration&action=index'>".translate('LBL_MODULE_NAME','Administration')."</a>",
translate('LBL_MASS_EMAIL_MANAGER_TITLE','Administration'),
);
}
/**
* @see ViewList::listViewProcess()
*/
function listViewProcess()
{
parent::listViewProcess();
global $app_strings;
echo "<form action=\"index.php\" method=\"post\" name=\"EmailManDelivery\" id=\"form\">
<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" class='actionsContainer'>
<tr><td style=\"padding-bottom: 2px;\">
<input type=\"hidden\" name=\"module\" value=\"EmailMan\">
<input type=\"hidden\" name=\"action\">
<input type=\"hidden\" name=\"return_module\">
<input type=\"hidden\" name=\"return_action\">
<input type=\"hidden\" name=\"manual\" value=\"true\">
<input title=\"".$app_strings['LBL_CAMPAIGNS_SEND_QUEUED']."\"
accessKey=\"".$app_strings['LBL_SAVE_BUTTON_KEY']."\" class=\"button\"
onclick=\"this.form.return_module.value='EmailMan'; this.form.return_action.value='index'; this.form.action.value='EmailManDelivery'\"
type=\"submit\" name=\"Send\" value=\"".$app_strings['LBL_CAMPAIGNS_SEND_QUEUED']."\">
</td></tr></table></form>";
}
}