Telnet & PowerShell SMTP

Occasionally I find myself needing to test email via an alternate source. Perhaps I want to test to see if a system is answering as part of troubleshooting for instance.

Well, telnet works great for that of course. Here’s an example of that, telnetting to port 25., The lines in bold, what I type.


Gregorys-MacBook-Pro:~ gvandenham$ telnet webmail.gogo.com 25

Trying 10.1.200.05...
Connected to webmail.gogo.com.
Escape character is '^]'.
220 il-ecs-01.gogo.local Microsoft ESMTP MAIL Service ready at Mon, 1 Jun 2015 16:56:09 -0500

ehlo fax.gogo.com

250-il-ecs-01.gogo.local Hello [10.1.100.13]
250-SIZE 36700160
250-PIPELINING
250-DSN
250-ENHANCEDSTATUSCODES
250-STARTTLS
250-8BITMIME
250-BINARYMIME
250 CHUNKING

mail from:gvandenham@fax.gogo.com

250 2.1.0 Sender OK

rcpt to:bacuservice@gogo.com

250 2.1.5 Recipient OK

data

354 Start mail input; end with .

subject: test fax message

two empty returns here (press enter, enter)

hello, this is a test message from gogo fax services.

.

250 2.6.0 <eaa633c49a433db29e123dd5ed37798c@il-ecs-01.gogo.local> [InternalId=12060898167846, Hostname=il-ecs-01.gogo.local] Queued mail for delivery

quit

221 2.0.0 Service closing transmission channel
Connection closed by foreign host.

 

Now, there is a way to send email via powershell as well, if you’re looking for a quick and dirty way to push email out.

Send-MailMessage -To "Greg VDH <Greg.VDH@test.local>" -From "John Smith
<john.smith@test.local>"
-Subject "Reporting Document" -Body "Here's the document you wanted" -
Attachments "C:\Report.doc"
-SmtpServer smtp.test.local



Leave a Reply

Your email address will not be published. Required fields are marked *