I am using server.mail()
function to check if the mail relay is available or not. I am getting a response from the server as not expected.
send: 'mail FROM:<bhanukrsingh@outlook.com> b h a n u k r s i n g h @ o u t l o o k . c o m\r\n'
reply: b'501 5.5.4 Invalid arguments [CO1NAM05FT018.eop-nam05.prod.protection.outlook.com]\r\n'
why am I getting my email ID like this? It should be like this send: 'mail FROM:<bhanukrsingh@outlook.com> bhanukrsingh@outlook.com\r\n'
I used print(repr(email))
to check if I am reading the file incorrectly, but that's also not the case!
Where am I doing wrong?
This is the link to my full code : https://github.com/Rwarlock/mxrecordchecker/blob/master/mxrecord.py
I found the fix.
Basically I used was using this part of code in order to send mail
server.mail('bhanukrsingh@outlook.com',email)
But now I am using this :
server.mail('example@outlook.com')
server.rcpt(email)
And this is giving me the server response as I needed:
send: 'mail FROM:<example@outlook.com>\r\n'
send: 'rcpt TO:<example@outlook.com>\r\n'