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

2014-12-17 Thread Chris Angelico
On Thu, Dec 18, 2014 at 7:59 AM, Michael Ströder  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
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2014-12-17 Thread Michael Ströder
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.
> 
> denymessage   = Restricted characters in address
> domains   = +local_domains
> local_parts   = ^[.] : ^.*[@%!/|]
> 
> denymessage   = 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.

-- 
https://mail.python.org/mailman/listinfo/python-list


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

2014-12-17 Thread Radomir Wojcik
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 *

-- 
https://mail.python.org/mailman/listinfo/python-list


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

2014-12-17 Thread Radomir Wojcik
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.

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

denymessage   = 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
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2014-12-17 Thread Radomir Wojcik
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
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2014-12-17 Thread Radomir Wojcik
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
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2014-12-17 Thread Ervin Hegedüs
Hi,

On Wed, Dec 17, 2014 at 08:16:23AM -0800, radzh...@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
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2014-12-17 Thread radzhome
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 !
-- 
https://mail.python.org/mailman/listinfo/python-list