Gmail mail server

I used the Googles slick interface to receive my mail and it will always be here:

https://mail.google.com/a/yourdomainhere.com

I want to write a python script that sends mail, so I was not able to configure the server settings

smtp = smtplib.SMTP('mail server should be what?', what is the port)
smtp.login('username@yourdomainhere.com', 'pass')

Please can someone help me?

thank

+3
source share
3 answers

Everything on the gmail support site, see http://mail.google.com/support/bin/answer.py?hl=en&answer=13287

+6
source

Take a look at the help: http://mail.google.com/support/bin/answer.py?hl=en&answer=13287

Its smtp.gmail.com

0
source

SMTP SMP- ISP. Google .

To use Google servers directly, you need to find the MX records provided by Google through DNS. The program Pythonrequires a DNS library. Here is an example using the dnspythonDNS toolkit for Python.

>>> from dns import resolver
>>> mxrecs = resolver.query('gmail.com', 'MX')
>>> [mx for mx in mxrecs]
[<DNS IN MX rdata: 20 alt2.gmail-smtp-in.l.google.com.>, 
<DNS IN MX rdata: 40 alt4.gmail-smtp-in.l.google.com.>,
<DNS IN MX rdata: 30 alt3.gmail-smtp-in.l.google.com.>,
<DNS IN MX rdata: 10 alt1.gmail-smtp-in.l.google.com.>,
<DNS IN MX rdata: 5 gmail-smtp-in.l.google.com.>]
>>> mx.exchange.to_text()
'gmail-smtp-in.l.google.com.'
>>> mx.preference
5
>>> 

The preferred mail server here is gmail-smtp-in.l.google.comthat you can use with smtplibto forward messages.

0
source

Source: https://habr.com/ru/post/1747041/


All Articles