Send emails with Powershell (en-EN)
Main command: send-emailmessage
Additional commands:
-From "Mysendername@xx.com" //Senders email address
-To "myreceiver@xx.com" //First email address which needs to send mail
-Cc "example@xx.com" //Second email address which needs to send copy of mail
-Bcc "example2@xx.com" //Another email address which needs to send copy of mail. But this receiver will not see other receivers name.
-Attachments "Filename.xx" //Path and name of attachment
-Subject "About xxxx" //This is only subject which represents main info about mail
-Body "Hello please send me email" //Mail body where you are typing your full message
-Credential "Username or Domainname\Username" //Specifies a user account which has permission to do it, without a credential process will be started with current logged in user credentials
-DelilveryNotificationOption "OnSuccess" //This is notification option for yourself to remind that mail has sent, or failed, or delayed. Without this command there will not notify. There are few parameters for this command:
None: No need notification
OnSuccess: Notify if the delivery is successful
OnFailure: Notify if the delivery is unsuccessful
Delay: Notify if delivery is delayed
Never: Never notify
-Port "587" //If we have different port than standard then we will need this command. By default it will be sent through 25 port
-SmtpServer "smtp.mailserver.com" //Specifies your smtp server address
-UseSSL //If you need to use SSL for mail then type this commands. If not then not need to type it. By default if you didn't type this comand system will not use SSL.
-Priority "High" //By default without using this command mail has normal priority. This command specifies the priority of email. It has following commands:
Normal
Low
High
-Encoding "UTF8" /Specifies the encoding used for body and subject. If you typed on Turkish or Azeri or other language which best works with UTF8 encoding then you need type this command. By defaul systems uses ASCII encoding. Here are other codes which are possible for the encoding:
ASCII
UTF8
UTF7
UTF32
Unicode
OEM
BigEndianUnicode
Examples:
Sending email to your friend:
Sending email with attachment:
No comments:
Post a Comment