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.
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
- 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
May be interested
- Download and install Java on the computerto program java on your computer, you need to install the java environment, this tutorial will show you how to download and install java on your computer.
- Form a way of thinking like a programmerprogrammers are people who design, build and maintain computer software programs. in order to work as a programmer, you first need to form a way of thinking like a programmer.
- 5 free online HTML editing tools that test the best codeif you ask someone how to become web developers, they will tell you about javascript, python, web programming, etc. and of course html.
- Beginners of computer programming need to focus on what?programming is very interesting and extremely useful. so what should beginners learn about computer programming? let's find out in the article below!
- What is Java? Why choose Java?what is java? java is a high-level programming language, developed by sun microsystem and released in 1995. java runs on a variety of platforms, such as windows, mac and various versions of unix.
- Basic Java exercises, with sample decodingto serve your java learning needs, tipsmake.com has synthesized some java exercises from many sources, including sample code (for some articles). hopefully it can be helpful to learn your java programming language.