Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to solve "Unable to initialize SMTP properly." when using using git send-email?

Tags:

git

smtp

I was trying to send an patch using git .

When i try sending mail the following error output is generated

enter image description here

My .gitconfig file looks like this

enter image description here

like image 597
jones j alapat Avatar asked Jan 20 '15 05:01

jones j alapat


2 Answers

I have a smiler issue and,After lots of research I got the answer ...

Please configure the .gitconfig file like this ...

[sendemail]

from = [email protected]

smtpserver = smtp.gmail.com

smtpserverport = 587

smtpencryption = tls

smtpuser = [email protected]

smtppass = password

suppresscc = self

chainreplyto = false

After that you must have to allow your mail account to login from less secure App ,like for gmail to do the same follow the link https://support.google.com/accounts/answer/6010255?hl=en

TO debug the actual error you can enable the following flag..

--smtp-debug=1

like image 63
Aman Jaiswal Avatar answered Nov 03 '22 21:11

Aman Jaiswal


Corporate firewalls may block the required ports

I noticed that this problem only happened at work and not at home, and then found out that my work firewall was blocking the required IMAP / SMTP ports.

If that is the case, you must talk to your network administrator.

The difference is that when you use a web interface like gmail's, all traffic goes through HTTP ports, which are allowed, but git send-email uses the email protocol ports directly.

A good way to test that without polluting public mailing lists is to try to send regular emails with mutt or some other local email client first.

You can also check if outgoing ports are getting blocked with answers for this question: https://superuser.com/questions/631087/how-to-easily-determine-which-outbound-ports-arent-blocked-by-firewall