smtp examples¶
python3
import smtplib mailserver = smtplib.SMTP('smtp.office365.com',587) mailserver.ehlo() mailserver.starttls() mailserver.login('account', 'password') message = ('Subject: testing\r\n\r\n') message = message + 'this is a test mail, don't reply to it.' mailserver.sendmail('from','to', message)python3 testing.py
c#
using System.Net.Mail; class mail { public static void Main() { SmtpClient smtp = new SmtpClient(); smtp.Host = "smtp.office365.com"; smtp.Port = 587; smtp.EnableSsl = true; smtp.Credentials = new System.Net.NetworkCredential("account", "password"); MailMessage message = new MailMessage("from", "to", "testing", "this is a test mail, don't reply to it."); smtp.Send(message); } }csc testing.cs
telnet
https://docs.microsoft.com/en-us/exchange/mail-flow/test-smtp-with-telnet?view=exchserver-2019