Hi All,
        This is fixed. This wasn't the specific python error - It was email 
server error. 

Solution:  I edited my postfix *master.cf* file and changed the below line 
. Restarted the postfix server. That eliminated the connection error. 

*/etc/postfix/master.cf*


#smtps     inet  n       -       -       -       -       smtpd

to:

*smtps     inet  n       -       -       -       -       smtpd*


Thanks!

Rahul. 


On Monday, January 14, 2019 at 5:13:57 PM UTC+5:30, Rahul wrote:
>
> Hi All,
>         I have a custom email function that was working fine previously 
> (with gmail). Now after gmail's policies got updated, I am not able to use 
> it properly. I got myself an email server which works on port 465 (SSL)  or 
> port 26(Not secure/not recommended version) for SMTP. Also, I am able to 
> send and receive mails using outlook or thunderbird for my mail server.  
> However, I am not able to send emails using my server settings from my own 
> custom software. 
>
> I feed my application with below  - 
>
>    1. smtp server,  - mail.tsoft.xx.xx 
>    2. port_no,  - 465 or 26
>    3. user_name,  -- username@  
>    4. password  -- password for the user
>    
> Now I am getting Connection refused error. 
> <class 'socket.error'> [Errno 111] Connection refused
>
> File "/home/www-data/web2py/applications/Target/controllers/default.py", line 
> 408, in new_ticket
>     email(team_name, mail_Subject , final_mail_body, img1)
>   File "/home/www-data/web2py/applications/Target/controllers/default.py", 
> line 6151, in email
>     server = smtplib.SMTP(host, port)
>   File "/usr/lib/python2.7/smtplib.py", line 256, in __init__
>     (code, msg) = self.connect(host, port)
>   File "/usr/lib/python2.7/smtplib.py", line 316, in connect
>     self.sock = self._get_socket(host, port, self.timeout)
>   File "/usr/lib/python2.7/smtplib.py", line 291, in _get_socket
>     return socket.create_connection((host, port), timeout)
>   File "/usr/lib/python2.7/socket.py", line 575, in create_connection
>     raise err
> error: [Errno 111] Connection refused
>
>
> I referred to this group (below) but to no avail
>
>
> https://groups.google.com/forum/#!searchin/web2py/Connection$20refused|sort:date/web2py/_cgI-jPfoIM/9p21qXtqHdEJ
>
>
>
> I have tried changing my ports to 465, and 26 ( ironically only 26 works 
> from my local for sending mails but not in production where the application 
> is hosted. Even tried with it IP of the mail server but it wont work. even 
> tried with username without @ sign.  Please suggest  if you have any 
> idea/clues.
>
>
> Thanks,
>
> Rahul
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to