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

 

 

27 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.

Event management assignment writing services are essential and they have become very popular for those seeking event management essay writing help services since most of them seek Event Management Writing Services.

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.

Math may be considered a difficult subject, however, if you are thinking of making a career in this subject you know it is also interesting and has the potential to place you in the best companies and organizations. With a constant urge of performing well on exams and tests and homework and assignments, you may be feeling fatigued. It is better to take help from a renowned online service provider like Help in Homework. Our experts at Help in Homework provide top notch math assignment help to students and help them fetch the prestigious A grade at a very affordable rate. Our experts are specialized in the subject and accommodate your instructions and keep the assignment 100% plagiarism-free.

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.

Do you also want to take online Assignment help? Then don’t worry, we will help you! We offer you the best assignment writing services at a very low price. Browse our website for taking the best assignment writing help.

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.

Opt for our Assignment Help to finish your assignments and submit them within the deadline. No need to take the stress of insufficient knowledge and lack of skills when you have an online assignment writing expert for writing your assignment in Qatar.

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.

Information on web is always fascinating. Let me point you to this page with more interesting stuff!

Post a Comment

Popular Posts

Share

Twitter Delicious Facebook Digg Stumbleupon Favorites More