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, smtp.office365.com.

 

 

 

Script:

 

#

#

$SMTPServer = "smtp.office365.com"

$EmailFrom = "Santhosh@virtualsecuritysolutions.com"

$EmailTo = "santhosh@ss-ts.com"

#

#Send-MailMessage Reference - https://msdn.microsoft.com/en-us/powershell/reference/5.1/microsoft.powershell.utility/send-mailmessage

#

#

 

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 - https://1drv.ms/t/s!AuVEEHIwTxv9h4ZXLslcu1MzA8ZSqw

2.       TechNet Gallery - https://1drv.ms/t/s!AuVEEHIwTxv9h4ZXLslcu1MzA8ZSqw

 

 

26 comments:

You can also read more great articles on this topic at this https://writemyessay4me.org/blog/university-professors 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 - https://speedypaper.com/blog/50-rhetorical-analysis-essay-topics.

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 https://essaysprofessors.com/mba-essay-writing-service.html .

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

Seeking for the Physics Assignment Help ? If yes then have a look here.

Use Finance assignment help to finish your finance or accounting papers without messing yourself. You will get assured solutions to your numerical questions within your defined date or time.

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!

For getting instant Assignment Help , you can check our website and order assistance. Assignments are written on a priority basis and delivered to you without any delay. If you choose our writing services then you will have thousands of other advantages as well.

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.

I am always searching online for articles that can help me. There is obviously a lot to know about this. I think you made some good points in Features also. Keep working, great job ! Also visit my website: 온라인카지노

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: 온라인카지노

Great Guest Posts is very selective with our guest post partner sites and only allows the best. We will ensure to boost your site authority and SERP performance with powerful white-hat links. Paid Guest posts links are also considered 100% natural as they’re surrounded by content related to your business.

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

If you want INTI International University Assignment Help then check details here. We will provide you all the related stuff under a one roof. You are recommended to check the entire details by going through the link.

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.

Post a Comment

Popular Posts

Share

Twitter Delicious Facebook Digg Stumbleupon Favorites More