Ticket #1484767: roundcubemail-identity-smtp.svn1039.diff
| File roundcubemail-identity-smtp.svn1039.diff, 8.5 KB (added by Hobbes, 3 years ago) |
|---|
-
SQL/mysql.update-svn1037.sql
1 -- RoundCube Webmail update script for MySQL databases 2 -- Updates from revision 1037 to current 3 4 ALTER TABLE `identities` 5 ADD `smtp_server` varchar(128) NOT NULL default '', 6 ADD `smtp_port` int(5) unsigned NOT NULL default '0', 7 ADD `smtp_user` varchar(128) NOT NULL default '', 8 ADD `smtp_pass` varchar(128) NOT NULL default '', 9 ADD `smtp_auth_type` varchar(128) NOT NULL default '', 10 ADD `smtp_helo_host` varchar(128) NOT NULL default ''; 11 -
SQL/mysql.initial.sql
59 59 `bcc` varchar(128) NOT NULL default '', 60 60 `signature` text NOT NULL, 61 61 `html_signature` tinyint(1) NOT NULL default '0', 62 `smtp_server` varchar(128) NOT NULL default '', 63 `smtp_port` int(5) unsigned NOT NULL default '0', 64 `smtp_user` varchar(128) NOT NULL default '', 65 `smtp_pass` varchar(128) NOT NULL default '', 66 `smtp_auth_type` varchar(128) NOT NULL default '', 67 `smtp_helo_host` varchar(128) NOT NULL default '', 62 68 PRIMARY KEY (`identity_id`), 63 69 KEY `user_id` (`user_id`) 64 70 ); -
program/include/rcube_smtp.inc
53 53 * 54 54 * @return bool Returns TRUE on success, or FALSE on error 55 55 */ 56 function smtp_mail($from, $recipients, &$headers, &$body, &$response )56 function smtp_mail($from, $recipients, &$headers, &$body, &$response, $identity_arr) 57 57 { 58 58 global $SMTP_CONN, $CONFIG; 59 59 $smtp_timeout = null; 60 $smtp_host = $CONFIG['smtp_server'];61 $smtp_port = is_numeric($CONFIG['smtp_port']) ? $CONFIG['smtp_port'] : 25;62 $smtp_host_url = parse_url($CONFIG['smtp_server']);63 60 61 if ($identity_arr['smtp_server']) { 62 $smtp_host = $identity_arr['smtp_server']; 63 $smtp_port = is_numeric($identity_arr['smtp_port']) ? $identity_arr['smtp_port'] : 25; 64 $smtp_host_url = parse_url($identity_arr['smtp_server']); 65 $smtp_user = $identity_arr['smtp_user']; 66 $smtp_pass = $identity_arr['smtp_pass']; 67 $smtp_auth_type = $identity_arr['smtp_auth_type']; 68 $smtp_helo_host = $identity_arr['smtp_helo_host']; 69 } 70 else { 71 $smtp_host = $CONFIG['smtp_server']; 72 $smtp_port = is_numeric($CONFIG['smtp_port']) ? $CONFIG['smtp_port'] : 25; 73 $smtp_host_url = parse_url($CONFIG['smtp_server']); 74 $smtp_user = $CONFIG['smtp_user']; 75 $smtp_pass = $CONFIG['smtp_pass']; 76 $smtp_auth_type = $CONFIG['smtp_auth_type']; 77 $smtp_helo_host = $CONFIG['smtp_helo_host']; 78 } 79 64 80 // overwrite port 65 81 if ($smtp_host_url['host'] && $smtp_host_url['port']) 66 82 { … … 76 92 // create Net_SMTP object and connect to server 77 93 if (!is_object($smtp_conn)) 78 94 { 79 $helo_host = empty($ CONFIG['smtp_helo_host']) ? (empty($_SERVER['SERVER_NAME']) ? 'localhost' : $_SERVER['SERVER_NAME']) : $CONFIG['smtp_helo_host'];95 $helo_host = empty($smtp_helo_host) ? (empty($_SERVER['SERVER_NAME']) ? 'localhost' : $_SERVER['SERVER_NAME']) : $smtp_helo_host; 80 96 $SMTP_CONN = new Net_SMTP($smtp_host, $smtp_port, $helo_host); 81 97 82 98 // set debugging … … 94 110 } 95 111 96 112 // attempt to authenticate to the SMTP server 97 if ($ CONFIG['smtp_user'] && $CONFIG['smtp_pass'])113 if ($smtp_user && $smtp_pass) 98 114 { 99 115 if (strstr($CONFIG['smtp_user'], '%u')) 100 $smtp_user = str_replace('%u', $_SESSION['username'], $CONFIG['smtp_user']); 101 else 102 $smtp_user = $CONFIG['smtp_user']; 116 $smtp_user = str_replace('%u', $_SESSION['username'], $smtp_user); 103 117 104 if (strstr($CONFIG['smtp_pass'], '%p')) 105 $smtp_pass = str_replace('%p', decrypt_passwd($_SESSION['password']), $CONFIG['smtp_pass']); 106 else 107 $smtp_pass = $CONFIG['smtp_pass']; 118 if (strstr($smtp_pass, '%p')) 119 $smtp_pass = str_replace('%p', decrypt_passwd($_SESSION['password']), $smtp_pass); 108 120 109 $smtp_auth_type = empty($ CONFIG['smtp_auth_type']) ? NULL : $CONFIG['smtp_auth_type'];121 $smtp_auth_type = empty($smtp_auth_type) ? NULL : $smtp_auth_type; 110 122 $result = $SMTP_CONN->auth($smtp_user, $smtp_pass, $smtp_auth_type); 111 123 112 124 if (PEAR::isError($result)) -
program/localization/en_US/labels.inc
218 218 $labels['dstactive'] = 'Daylight savings'; 219 219 $labels['htmleditor'] = 'Compose HTML messages'; 220 220 $labels['htmlsignature'] = 'HTML signature'; 221 $labels['smtp_server'] = 'SMTP server'; 222 $labels['smtp_port'] = 'SMTP port'; 223 $labels['smtp_user'] = 'SMTP username'; 224 $labels['smtp_pass'] = 'SMTP password'; 225 $labels['smtp_auth_type'] = 'SMTP auth type'; 226 $labels['smtp_helo_host'] = 'SMTP HELO host'; 221 227 $labels['previewpane'] = 'Show preview pane'; 222 228 223 229 $labels['autosavedraft'] = 'Automatically save draft'; -
program/steps/settings/save_identity.inc
19 19 20 20 */ 21 21 22 $a_save_cols = array('name', 'email', 'organization', 'reply-to', 'bcc', 'standard', 'signature', 'html_signature' );22 $a_save_cols = array('name', 'email', 'organization', 'reply-to', 'bcc', 'standard', 'signature', 'html_signature', 'smtp_server', 'smtp_port', 'smtp_user', 'smtp_pass', 'smtp_auth_type', 'smtp_helo_host'); 23 23 $a_html_cols = array('signature'); 24 24 $a_boolean_cols = array('standard', 'html_signature'); 25 25 $updated = $default_id = false; -
program/steps/settings/edit_identity.inc
70 70 'bcc' => array('type' => 'text'), 71 71 'signature' => array('type' => 'textarea', 'size' => "40", 'rows' => "6"), 72 72 'html_signature'=>array('type' => 'checkbox', 'label' => 'htmlsignature', 'onclick' => 'return rcmail.toggle_editor(this, \'_signature\');'), 73 'smtp_server' => array('type' => 'text'), 74 'smtp_port' => array('type' => 'text'), 75 'smtp_user' => array('type' => 'text'), 76 'smtp_pass' => array('type' => 'text'), 77 'smtp_auth_type'=> array('type' => 'text'), 78 'smtp_helo_host'=> array('type' => 'text'), 73 79 'standard' => array('type' => 'checkbox', 'label' => 'setdefault')); 74 80 75 81 -
program/steps/mail/func.inc
1264 1264 /** 1265 1265 * Send the given message compose object using the configured method 1266 1266 */ 1267 function rcmail_deliver_message(&$message, $from, $mailto )1267 function rcmail_deliver_message(&$message, $from, $mailto, $identity_arr) 1268 1268 { 1269 1269 global $CONFIG; 1270 1270 … … 1272 1272 $msg_body = $message->get(); 1273 1273 1274 1274 // send thru SMTP server using custom SMTP library 1275 if ($ CONFIG['smtp_server'])1275 if ($identity_arr['smtp_server'] || $CONFIG['smtp_server']) 1276 1276 { 1277 1277 // generate list of recipients 1278 1278 $a_recipients = array($mailto); … … 1288 1288 1289 1289 // send message 1290 1290 $smtp_response = array(); 1291 $sent = smtp_mail($from, $a_recipients, ($foo = $message->txtHeaders($send_headers)), $msg_body, $smtp_response );1291 $sent = smtp_mail($from, $a_recipients, ($foo = $message->txtHeaders($send_headers)), $msg_body, $smtp_response, $identity_arr); 1292 1292 1293 1293 // log error 1294 1294 if (!$sent) -
program/steps/mail/sendmail.inc
304 304 // Begin SMTP Delivery Block 305 305 if (!$savedraft) 306 306 { 307 $sent = rcmail_deliver_message($MAIL_MIME, $from, $mailto );307 $sent = rcmail_deliver_message($MAIL_MIME, $from, $mailto, $identity_arr); 308 308 309 309 // return to compose page if sending failed 310 310 if (!$sent)
