How to send Email with Windows PowerShell
Sending email is a simple task that most people can do. Open the email application, enter the message, the recipient and press the send button. Operation is not too difficult, right? But have you ever considered other ways to email? One way to send email without going to the mail application is to send a message using Windows PowerShell.
Sending email is a simple task that most people can do. Open the email application, enter the message, the recipient and press the send button. Operation is not too difficult, right? But have you ever considered other ways to email? One way to send email without going to the mail application is to send a message using Windows PowerShell.
How to send email using PowerShell
Step 1: Open PowerShell window by searching PowerShell in the Start menu.
Step 2: Use the Gmail form below to set up email. The first line begins with the dollar sign that sets the variables to send 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: usersUsernameDocumentsSomeTextFile.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
Step 3: 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 .
Step 4: You can remove Attachment and CC if you don't need them and also delete them in the Send-MailMessage line.
Step 5: Use -UseSsl to make sure email is safe. You can also add -DeliveryNotificationOption OnSuccess if you want to receive confirmation that the message has been sent successfully.
Step 6: When running the command, it will prompt you to enter a username and password (Get-Credential) . Enter this information and your email will be sent.
This is another way to send an email, see the Guide to Email Automatically in Google Sheet with Google Script.
I wish you all success!
See more:
- Send email with another Gmail account
- Quickly view email sender information on Gmail with Gmail Sender Icons
- How to send email to self-destruct within 5 minutes on Gmail
You should read it
- Send Email using PHP
- How to send bulk emails on Apple Mail
- Instructions on how to send and receive email with Gmail
- How to send email using the command line in Linux
- Instructions on how to send mail with Gmail
- How to Send Large Video by e-mail
- Send anonymous anonymous emails with these 18 great websites
- Use Outlook Express to send / receive Yahoo mail
- How to set up SMTP server to send email using Outlook.com address
- How to Send Email with Telnet
- Instructions on how to Recall, recover mail sent in MS Outlook
- Email: Differences between POP3, IMAP and Exchange
Maybe you are interested
Instructions for setting up an Apple ID security key How to post photos to Facebook computer 360-degree Panorama mode Instructions to delete Mocha account on the phone Super cool and funny statuses and greetings The most meaningful and funniest happy birthday poems Rothschild is the richest family of all time