Email is so basic that most people don’t even think about it. Open up your mail client, type a message and recipient, and hit send. Not too tough, right?
But have you ever considered alternate ways to send emails? Whether you just want to geek out and do something techy or want to send an email without getting distracted by your inbox, there’s one hiding right on your Windows desktop.
How to Send an Email Using PowerShell
- Open a PowerShell window by searching for PowerShell in the Start Menu.
- Use the below Gmail template to set up your email. The first lines that start with dollar signs set up variables for sending the message, while the Send-MailMessage line is the actual command:
$From = "EmailAddress@gmail.com" $To = "SomeOtherAddress@whatever.com" $Cc = "AThirdUser@somewhere.com" $Attachment = "C:\users\Username\Documents\SomeTextFile.txt" $Subject = "Here's the Email Subject" $Body = "This is what I want to say" $SMTPServer = "smtp.gmail.com" $SMTPPort = "587" Send-MailMessage -From $From -to $To -Cc $Cc -Subject $Subject
-Body $Body -SmtpServer $SMTPServer -port $SMTPPort -UseSsl-Credential (Get-Credential) -Attachments $Attachment –DeliveryNotificationOption OnSuccess
- If using Yahoo mail, the server is smtp.mail.yahoo.com and the port is 465. For Outlook, the server is smtp-mail.outlook.com with port 587.
- You can remove the Attachment and CC lines if you don’t need them. Make sure to remove them from the Send-MailMessage line too.
- Including –UseSsl makes sure the email sense securely. You can also include -DeliveryNotificationOption OnSuccess if you want to receive confirmation that it sent successfully.
- Once you issue the command, it will prompt you for your username and password thanks to(Get-Credential). Enter that, and your email is on its way!
For another geeky way to do this, check out how you can send an email with Google Sheets.
What do you think about this method of sending emails? What other cool ways do you know to do this? Share them with us in the comments below!