Thursday, December 8, 2016

PowerShell - Send Test Email (Office 365) Using PowerShell


Here is a sample PowerShell script which can be to test email communication using a SMTP server. In this script, I am using Office 365 SMTP server,








$SMTPServer = ""

$EmailFrom = ""

$EmailTo = ""


#Send-MailMessage Reference -




Write-Host "`t`tSelect 1 - SMTP Test Message with No Attachmnet" -ForegroundColor Red

Write-Host "`t`tSelect 2 - SMTP Test Message" -ForegroundColor Red

$Option = Read-Host




Function EmailTest_No_Attachment


#with no attachement


$Cred = Get-Credential

$Sub = "SMTP Test Message - 1 - No Attachmnet"

$Bmessage = "SMTP Test Message - 1 with Attachment"

Send-MailMessage -From $EmailFrom -To $EmailTo -Subject $Sub -Body $Bmessage -SmtpServer $SMTPServer -Credential $cred -UseSsl -Port 587



Function EmailTest_With_Attachment


#with Attachment


$Cred = Get-Credential

$Sub = "SMTP Test Message - 1 with Attachment"

$Bmessage = "Test email body message - With Attachment"

$MyAttachment =  "C:\temp\1.docx"

Send-MailMessage -From $EmailFrom -To $EmailTo -Subject $Sub -Body $Bmessage -Attachments $MyAttachment -SmtpServer $SMTPServer -Credential $cred -UseSsl -Port 587






Switch ($Option)


        1 {EmailTest_No_Attachment}

        2 {EmailTest_With_Attachment}

    default {"Invalid Selection"}



Script download options:

1.        OneDrive -!AuVEEHIwTxv9h4ZXLslcu1MzA8ZSqw

2.       TechNet Gallery -!AuVEEHIwTxv9h4ZXLslcu1MzA8ZSqw




You can also read more great articles on this topic at this website, guys.

Hello! I just read this information and i can tell you that this article is useful. Thank you for sharing it. And look at this -

I got 5 on it, let’s go half on a sack this source

Very useful information, especially for those who are just starting programming. Students will find a lot of interesting things. I, in turn, want to recommend a great site. Here you can find information on how to write an essay or term paper customessaymeister

This means you have to let go of your judgement about what is right and what is wrong and keep your eyes open for what can help. It could be something simple, like a kid wanting to talk to you about their day, or something huge like an invitation to a conference with like-minded people. Stay open and you are guaranteed to surpass other people who are close-minded .

If you are decisive about placing an order at writing elites, you can always ask questions or share your concerns with its customer support representatives. Its pleasant, polite customer service staff works 24/7 to give you an immediate answer.

If you are supposed to complete a creative and original PPT Poster in agreement with the requirements set and the deadline indicated, but you consider that you will not handle it in a decent way, why not buy ppt from our trustworthy academic writing company.

Hello, thanks for sharing this interesting information I appreciate reading it. It's great that I found this post. It will help me with my computing skills. Moreover, I will use the information in my top quality essay provider. Thanks a lot.

This comment has been removed by the author.

The point of a laboratory report is to conduct an experiment, develop a hypothesis, and do research to support their claims. You also need to do precise calculations, collect data, analyze the results, and express it in a way that will be understandable to the reader. lab report writing service

Hard exams, assignments and homework are a now things of the past with Test Bank For Anatomy And Physiology 9th Edition. Order and download now!

Help In Homework offers English Assignment Help to students enrolled at colleges anywhere in the world. With PhD degrees under their belt, our team of English language experts has just the right qualifications to provide high quality homework assistance to students so that they will be able to impress their teachers with the submissions. Help In Homework would like to assure students that the homework our experts will write for them will be completely error free and uniquely crafted for each one based on the guidelines of their respective universities.

Very nice blog post. I like this site. Continue the good work! It is exciting to read it and, use it. Thanks for the article. Also visit my website: 온라인카지노

Its like you read my mind! You appear to know so much about this, like you wrote the book in it or something. I think that you could do with some pics to drive the message home a little bit, but other than that, this is magnificent blog. A great read. I’ll certainly be back. Also visit my website: 바카라사이트

I enjoy kinds very own post. It will be respectable to get a single narrative inside and outside of the core of this distinctive core specialized niche will likely be commonly knowledgeable. Also visit my website: 온라인카지노

Gain better scores in every assignment and exam with Test Bank For Mgmt 11th Edition. Be on the top of your class.

Prestige Park Grove juxtaposed next to each other with its own top- notch installations, boundaries, and distinguished realities. Prestige Villas Bangalore

Areas of Prestige Lavender Fields which might be at the outskirts of East Bangalore are near the IT corridor. These regions have confronted a dramatic decorate inside the range of actual property trends like Prestige Lavender Fields Bangalore at the side of the fee they control. Those regions which have been historically at the vanguard of this spike are consisting of Electronics City and Whitefield.

Prestige Serenity Shores which can be at the outskirts of East Bangalore are near the IT corridor.

brigade eldorado presents a diverse range of residential options, ensuring there is a perfect abode for every individual and family. From stylish apartments to spacious villas, each unit is meticulously designed to blend functionality, aesthetics, and comfort.

Thanks for publishing a wonderful blog post! Keep it up! Pay someone to Take My Online Math Class for me and get the best possible work for your maths assignments in the US. We always send unique content with no plagiarism. Choose your expert from the pool of 1000+ Ph.D. tutors. You can talk to us any time of the day. There are many benefits to avail of yourself when you can opt for online math classes at So, hire us today to do your math homework at an affordable rate.

Post a Comment

Popular Posts


Twitter Delicious Facebook Digg Stumbleupon Favorites More