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
- Next time, Microsoft will release PowerShell updates via Windows Update Windowsmicrosoft is making it easier to update powershell on windows 10 and windows server devices by releasing updates via microsoft update in the future.
- How are Command Prompt (cmd) and PowerShell different?windows 7 has added powershell, a more powerful command line and script language. since windows 7, powershell has become more prominent, even becoming the default choice in windows 10. how is it different from command prompt?
- How to use PowerShell's default parameter to change the command behaviormany people like to use powershell because it allows them to do things that can't be done with the windows gui. however, it is undeniable that some powershell cmdlets can be tedious or complicated. but what if there is a way to edit these cmdlets and get them to 'behave' the way you want?
- How to Send Email with Telnetsoftware like thunderbird and outlook make sending emails magical. but who knows, your email may not reach where it needs to go. how do you know what happens after you click the 'send' button? one way is to try sending emails from the email service provider's external server using telnet - a small application built into the computer. you will receive an error message if the email software does not send the message.
- Send anonymous anonymous emails with these 18 great websitesmany people will wonder why they need an anonymous email service while there are many great and free email services like gmail, outlook, yahoo! mail. privacy and anonymity are the answers.
- How to use Mailspre to send anonymous emailsmailspre is an unlimited email service, without account registration.
- How to add 'Open PowerShell window here as administrator' to the right-click menu on Windows 10windows 10 comes with windows powershell 5.0. windows powershell is a task-based command-line shell and scripting language specifically designed for system administration. this tutorial will show you how to add or remove 'open powershell window here as administrator' on windows 10 right-click menu.
- 10 PowerShell commands help you manage the remote computer most effectivelywindows powershell is a command executive command system and script scripting language that you can use to manage your system. in the following article, network administrator will show you 10 powershell commands to manage your computer remotely effectively.
- How to send bulk emails on Apple Mailone of the fastest ways for you to email a group on your iphone is to create a contact with an email group that you email regularly, such as a business exchange.
- What is PowerShell Basic commands in PowerShellwhat is powershell basic commands in powershell. first of all, to understand it briefly, powershell is a command-line interface similar to cmd, it can do everything cmd can do and even more. powershell is gradually becoming the default