summaryrefslogtreecommitdiff
path: root/program/steps
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2008-10-01 14:57:43 +0000
committeralecpl <alec@alec.pl>2008-10-01 14:57:43 +0000
commitfd51e0fea582da90f344bfb56ba797da1baa30f9 (patch)
tree06996af3b1bd692d3fab8c39784caa2a11c7bc1e /program/steps
parent56cf503a1b57b9fbf453a051c44cd12750b99cc0 (diff)
- Better handling of "no identity" and "no email in identity" situations (#1485117)
Diffstat (limited to 'program/steps')
-rw-r--r--program/steps/mail/compose.inc2
-rw-r--r--program/steps/mail/sendmail.inc20
2 files changed, 16 insertions, 6 deletions
diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc
index 830168c24..15d26a260 100644
--- a/program/steps/mail/compose.inc
+++ b/program/steps/mail/compose.inc
@@ -81,7 +81,7 @@ if (!is_array($_SESSION['compose']) || $_SESSION['compose']['id'] != get_input_v
}
// add some labels to client
-rcube_add_label('nosubject', 'norecipientwarning', 'nosubjectwarning', 'nobodywarning', 'notsentwarning', 'savingmessage', 'sendingmessage', 'messagesaved', 'converting');
+rcube_add_label('nosubject', 'nosenderwarning', 'norecipientwarning', 'nosubjectwarning', 'nobodywarning', 'notsentwarning', 'savingmessage', 'sendingmessage', 'messagesaved', 'converting');
// add config parameter to client script
$OUTPUT->set_env('draft_autosave', !empty($CONFIG['drafts_mbox']) ? $CONFIG['draft_autosave'] : 0);
diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc
index d342124a4..4706af22f 100644
--- a/program/steps/mail/sendmail.inc
+++ b/program/steps/mail/sendmail.inc
@@ -63,9 +63,10 @@ function rcmail_get_identity($id)
$out = $sql_arr;
$out['mailto'] = $sql_arr['email'];
$name = strpos($sql_arr['name'], ",") ? '"'.$sql_arr['name'].'"' : $sql_arr['name'];
- $out['string'] = sprintf('%s <%s>',
- rcube_charset_convert($name, RCMAIL_CHARSET, $OUTPUT->get_charset()),
- $sql_arr['email']);
+ $out['string'] = rcube_charset_convert($name, RCMAIL_CHARSET, $OUTPUT->get_charset());
+ if ($sql_arr['email'])
+ $out['string'] .= ' <' . $sql_arr['email'] . '>';
+
return $out;
}
@@ -160,8 +161,11 @@ else if (empty($mailto))
$mailto = 'undisclosed-recipients:;';
// get sender name and address
-$identity_arr = rcmail_get_identity(get_input_value('_from', RCUBE_INPUT_POST));
-$from = $identity_arr['mailto'];
+$from = get_input_value('_from', RCUBE_INPUT_POST);
+$identity_arr = rcmail_get_identity($from);
+
+if ($identity_arr)
+ $from = $identity_arr['mailto'];
if (empty($identity_arr['string']))
$identity_arr['string'] = $from;
@@ -351,6 +355,12 @@ $MAIL_MIME->headers($headers);
// Begin SMTP Delivery Block
if (!$savedraft)
{
+ // check for 'From' address (identity may be incomplete)
+ if ($identity_arr && !$identity_arr['mailto']) {
+ $OUTPUT->show_message('nofromaddress', 'error');
+ $OUTPUT->send('iframe');
+ }
+
$sent = rcmail_deliver_message($MAIL_MIME, $from, $mailto);
// return to compose page if sending failed