Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #82598 > unrolled thread

smptplib problem SMTPRecipientsRefused for emails with ! exclamation mark in local portion of email

Started byradzhome@gmail.com
First post2014-12-17 08:16 -0800
Last post2014-12-17 10:15 -0800
Articles 8 — 5 participants

Back to article view | Back to comp.lang.python


Contents

  smptplib problem SMTPRecipientsRefused for emails with ! exclamation mark in local portion of email radzhome@gmail.com - 2014-12-17 08:16 -0800
    Re: smptplib problem SMTPRecipientsRefused for emails with ! exclamation mark in local portion of email Ervin Hegedüs <airween@gmail.com> - 2014-12-17 17:59 +0100
    Re: smptplib problem SMTPRecipientsRefused for emails with ! exclamation mark in local portion of email Radomir Wojcik <radzhome@gmail.com> - 2014-12-17 09:21 -0800
    Re: smptplib problem SMTPRecipientsRefused for emails with ! exclamation mark in local portion of email Radomir Wojcik <radzhome@gmail.com> - 2014-12-17 09:21 -0800
    Re: smptplib problem SMTPRecipientsRefused for emails with ! exclamation mark in local portion of email Radomir Wojcik <radzhome@gmail.com> - 2014-12-17 09:25 -0800
      Re: smptplib problem SMTPRecipientsRefused for emails with ! exclamation mark in local portion of email Michael Ströder <michael@stroeder.com> - 2014-12-17 21:59 +0100
        Re: smptplib problem SMTPRecipientsRefused for emails with ! exclamation mark in local portion of email Chris Angelico <rosuav@gmail.com> - 2014-12-18 09:00 +1100
    Re: smptplib problem SMTPRecipientsRefused for emails with ! exclamation mark in local portion of email Radomir Wojcik <radzhome@gmail.com> - 2014-12-17 10:15 -0800

#82598 — smptplib problem SMTPRecipientsRefused for emails with ! exclamation mark in local portion of email

Fromradzhome@gmail.com
Date2014-12-17 08:16 -0800
Subjectsmptplib problem SMTPRecipientsRefused for emails with ! exclamation mark in local portion of email
Message-ID<2ca6ae04-fd8f-4370-96b9-5af04072e102@googlegroups.com>
smtplib.SMTPRecipientsRefused: {'aahlin!@gmail.com': (550, 'restricted characters in address')}

As in this question, the answer has reference to RFCs that spec it out, and state that exclamations are ok, so why is smptplib throwint this error?

http://stackoverflow.com/questions/2049502/what-characters-are-allowed-in-email-address

Django uses smtplib to send emails so it in turn fails too but email validation allows you to enter !

[toc] | [next] | [standalone]


#82600

FromErvin Hegedüs <airween@gmail.com>
Date2014-12-17 17:59 +0100
Message-ID<mailman.17009.1418835547.18130.python-list@python.org>
In reply to#82598
Hi,

On Wed, Dec 17, 2014 at 08:16:23AM -0800, radzhome@gmail.com wrote:
> smtplib.SMTPRecipientsRefused: {'aahlin!@gmail.com': (550, 'restricted characters in address')}
> 
> As in this question, the answer has reference to RFCs that spec it out, and state that exclamations are ok, so why is smptplib throwint this error?
> 
> http://stackoverflow.com/questions/2049502/what-characters-are-allowed-in-email-address
> 
> Django uses smtplib to send emails so it in turn fails too but email validation allows you to enter !

I think that this exception came from your SMTP server, not from
smtplib. Check your smtpd log.

You can try to send through that smtpd at another way (eg.
netcat) with that address - may be then you can check the result.


a.

-- 
I � UTF-8

[toc] | [prev] | [next] | [standalone]


#82602

FromRadomir Wojcik <radzhome@gmail.com>
Date2014-12-17 09:21 -0800
Message-ID<9439e07b-b06b-4e7b-8e36-fdd4bed6f4f0@googlegroups.com>
In reply to#82598
thanks i'll try that, I can also telnet on the server and see what I get if I use that recipient. I'm using exim, not sure why it would have that restriction

[toc] | [prev] | [next] | [standalone]


#82603

FromRadomir Wojcik <radzhome@gmail.com>
Date2014-12-17 09:21 -0800
Message-ID<a11df606-bcff-4389-8902-b58a24a90f1c@googlegroups.com>
In reply to#82598
thanks i'll try that, I can also telnet on the server and see what I get if I use that recipient. I'm using exim, not sure why it would have that restriction

[toc] | [prev] | [next] | [standalone]


#82604

FromRadomir Wojcik <radzhome@gmail.com>
Date2014-12-17 09:25 -0800
Message-ID<c2274d95-0576-45dd-a55b-1e45bc09ef75@googlegroups.com>
In reply to#82598
No need to do more troubleshooting, need to update the config. Found that exim default config denies these so nothing to do with smptlib indeed:

What this statement is doing is to accept unconditionally all recipients in messages that are submitted by SMTP from local processes using the standard input and output (that is, not using TCP/IP). A number of MUAs operate in this manner.

deny    message       = Restricted characters in address
        domains       = +local_domains
        local_parts   = ^[.] : ^.*[@%!/|]

deny    message       = Restricted characters in address
        domains       = !+local_domains
        local_parts   = ^[./|] : ^.*[@%!] : ^.*/\\.\\./
These statements are concerned with local parts that contain any of the characters "@", "%", "!", "/", "|", or dots in unusual places. Although these characters are entirely legal in local parts (in the case of "@" and leading dots, only if correctly quoted), they do not commonly occur in Internet mail addresses.

http://www.exim.org/exim-html-current/doc/html/spec_html/ch-the_default_configuration_file.html

[toc] | [prev] | [next] | [standalone]


#82615

FromMichael Ströder <michael@stroeder.com>
Date2014-12-17 21:59 +0100
Message-ID<m6sqq2$7ce$1@dont-email.me>
In reply to#82604
Radomir Wojcik wrote:
> No need to do more troubleshooting, need to update the config. Found that exim default config denies these so nothing to do with smptlib indeed:
> 
> What this statement is doing is to accept unconditionally all recipients in messages that are submitted by SMTP from local processes using the standard input and output (that is, not using TCP/IP). A number of MUAs operate in this manner.
> 
> deny    message       = Restricted characters in address
>         domains       = +local_domains
>         local_parts   = ^[.] : ^.*[@%!/|]
> 
> deny    message       = Restricted characters in address
>         domains       = !+local_domains
>         local_parts   = ^[./|] : ^.*[@%!] : ^.*/\\.\\./
> These statements are concerned with local parts that contain any of the characters "@", "%", "!", "/", "|", or dots in unusual places. Although these characters are entirely legal in local parts (in the case of "@" and leading dots, only if correctly quoted), they do not commonly occur in Internet mail addresses.
> 
> http://www.exim.org/exim-html-current/doc/html/spec_html/ch-the_default_configuration_file.html

You should really think about why these chars were excluded in the
configuration: The reason is that those they are special in shells.

And many SMTP deployments have pretty naive (shell) scripts or software with
shell exits. So allowing those chars can cause more or less big security
risks. For this reason it's likely that you will end in spam filters / black
lists etc. because systems may assume you want to do some harm.

So I would really rethink the requirements.

Your mileage may vary. But you have been warned.

Ciao, Michael.

[toc] | [prev] | [next] | [standalone]


#82618

FromChris Angelico <rosuav@gmail.com>
Date2014-12-18 09:00 +1100
Message-ID<mailman.17020.1418853653.18130.python-list@python.org>
In reply to#82615
On Thu, Dec 18, 2014 at 7:59 AM, Michael Ströder <michael@stroeder.com> wrote:
> You should really think about why these chars were excluded in the
> configuration: The reason is that those they are special in shells.
>
> And many SMTP deployments have pretty naive (shell) scripts or software with
> shell exits. So allowing those chars can cause more or less big security
> risks. For this reason it's likely that you will end in spam filters / black
> lists etc. because systems may assume you want to do some harm.
>
> So I would really rethink the requirements.
>
> Your mileage may vary. But you have been warned.

It's worth noting that the SMTP spec never says that every server must
accept all characters. I could create a perfectly compliant mail
server in which recipient names may not include the letter 'e', for
instance. It would be a bug if smtplib rejected those, but since the
rejection is coming from the server, that's fairly legit.

ChrisA

[toc] | [prev] | [next] | [standalone]


#82605

FromRadomir Wojcik <radzhome@gmail.com>
Date2014-12-17 10:15 -0800
Message-ID<9136a5c3-72ff-4959-b26a-ebddfdedb634@googlegroups.com>
In reply to#82598
Its all in here for those using exim4

http://www.exim.org/exim-html-current/doc/html/spec_html/ch-the_default_configuration_file.html

I went into /etc/exim4 and ran this command to find where the deny message is stored, which lead me to the regex variable CHECK_RCPT_LOCAL_LOCALPARTS. So I searched for it, updated the values and restarted exim:

    grep -r CHECK_RCPT_LOCAL_LOCALPARTS *

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web