Opened 4 years ago

Closed 4 years ago

#1485654 closed Bugs (fixed)

Fail to send mail if the name of the sender contains a @

Reported by: Hosteurope Owned by:
Priority: 2 Milestone: 0.2.1
Component: Core functionality Version: 0.2-beta
Severity: normal Keywords: quote fail send
Cc:

Description

If the Name of the From/CC/BCC/To contains a @ the mailserver doesn't acceppt the message because the name issn't correctly quoted.

Change History (7)

comment:1 Changed 4 years ago by alec

  • Milestone changed from 0.2.1 to 0.2-stable

There's no problem with names from addressbook and identities.

comment:2 in reply to: ↑ description ; follow-up: Changed 4 years ago by Hosteurope

  • Summary changed from Fail to send mail if the name of the recepient or sender contains a @ to Fail to send mail if the name of the sender contains a @

Replying to Hosteurope:

If the Name of the From/CC/BCC/To contains a @ the mailserver doesn't acceppt the message because the name issn't correctly quoted.

Ok, To/CC/BCC is correkt quoted, but From is not.

If you use an identity with xyz@… as name and xyz@… as E-Mail-Adress the name isn't quoted.

comment:3 in reply to: ↑ 2 Changed 4 years ago by alec

Replying to Hosteurope:

If you use an identity with xyz@… as name and xyz@… as E-Mail-Adress the name isn't quoted.

Fixed in [a1733f06].

comment:4 Changed 4 years ago by robin

  • Resolution set to fixed
  • Status changed from new to closed

Closing the ticket, fix is confirmed.

comment:5 follow-up: Changed 4 years ago by alec

  • Resolution fixed deleted
  • Status changed from closed to reopened

Not exactly, we should add quoting for names entered by users in compose fields. Those from addressbook and identities don't need this now.

comment:6 in reply to: ↑ 5 Changed 4 years ago by robin

Replying to alec:

Not exactly, we should add quoting for names entered by users in compose fields.

Sorry, missed that...

Does following break any existing functionallity?

--- program/steps/mail/sendmail.inc     (revision 2196)
+++ program/steps/mail/sendmail.inc     (working copy)
@@ -153,8 +153,8 @@
 $input_charset = $OUTPUT->get_charset();
 $message_charset = isset($_POST['_charset']) ? $_POST['_charset'] : $input_charset;

-$mailto_regexp = array('/[,;]\s*[\r\n]+/', '/[\r\n]+/', '/[,;]\s*$/m', '/;/', '/(\S{1})(<\S+@\S+>)/U');
-$mailto_replace = array(', ', ', ', '', ',', '\\1 \\2');
+$mailto_regexp = array('/[,;]\s*[\r\n]+/', '/[\r\n]+/', '/[,;]\s*$/m', '/;/', '/(.*)\s*(<\S+@\S+>)/U');
+$mailto_replace = array(', ', ', ', '', ',', '"\\1" \\2');

 // replace new lines and strip ending ', ', make address strings more valid also
 $mailto = preg_replace($mailto_regexp, $mailto_replace, get_input_value('_to', RCUBE_INPUT_POST, TRUE, $message_charset));

I modified only the 5th expression.

comment:7 Changed 4 years ago by alec

  • Resolution set to fixed
  • Status changed from reopened to closed

Fixed in [c58c0aed].

Note: See TracTickets for help on using tickets.