Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is smtp_server.ehlo and what is it used for?

Tags:

python

I was seeing a smtplib python tutorial, and I see these code lines:

smtp_server = smtplib.SMTP_SSL('smtp.gmail.com', 465)

smtp_server.ehlo()

What is that .ehlo used for?

like image 486
Haytham Avatar asked Dec 06 '25 17:12

Haytham


1 Answers

EHLO ("Extended Hello") is the SMTP command the client uses to tell the server that it is an SMTP client (HELO is the old SMTP protocol, while EHLO is the extended SMTP initialisation command).

EHLO was introduced with RFC 1869 back in 1995, so for any actual use you'll se EHLO used these days.

In effect it's just telling your smtp library to send the "Hello, I'm an STMP client and want to use the extended command set" message.

like image 138
MatsLindh Avatar answered Dec 08 '25 10:12

MatsLindh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!