How to test Office 365 SMTP server using PowerShell

Office 365 supports SMTP relay for authenticated accounts using TLS encryption.

Testing SMTP access is traditionally done using Telnet, but that’s not always an option when using Office 365 due to the authentication requirement.

Fortunately it’s easy to use PowerShell to accomplish the same thing.


How to test SMTP server using PowerShell:

Capture and store the Office 365 credentials for the account you intend to use for SMTP auth:

$msolcred = get-credential | save the credential of from address

Use the stored credentials to send a test message from user@domain.com to user@example.com, over port 587 (Encrypted w/ SSL):

Send-MailMessage –From user@domain.com –To user@example.com –Subject “Test Email” –Body “Test SMTP Relay Service” -SmtpServer smtp.office365.com -Credential $msolcred -UseSsl -Port 587

Give user mailbox rights on Exchange Hosted – BPOS

To give a user full mailbox rights, to be able to send meeting requests as another user do the following:

1. Open Migration Command Shell

2. Type: Add-MSOnlineMailPermission –Identity UserName1@DomainName -TrustedUser UserName2@DomainName -GrantFullAccess $True

Where username1 is the mailbox that you want to give Username2 permission to

3. Enter the proper admin credentials and make sure that the command shell replies with Successfully granted user account username1.domain.com full access permission to mailbox username2@domain.com

How to set up a forwarder – Microsoft Online Services

1. Download MOS Migration tool from below url :
Microsoft Online Services Migration Tools (32 bit)
http://www.microsoft.com/downloads/en/details.aspx?familyid=9ed5f4c1-7f0b-4506-a214-32093af6147a&displaylang=en

Microsoft Online Services Migration Tools (64 bit)
http://www.microsoft.com/downloads/en/details.aspx?familyid=5547634c-5e49-4dbd-b6b0-457b38a75f33&displaylang=en

2. Log in to Administration Center for domain in BPOS-S and create a contact for the email address to whom you want to forward emails.

3. Launch the ‘Migration Command Shell’ from your programs folder.

4. Use the below cmdlet to set external forwarding.

Set-MSOnlineAlternateRecipient -Identity <email address of your hosted account> -AlternateRecipient <email address to forward to> -DeliverToBoth $true

Example: Set-MSOnlineAlternateRecipient -Identity name@kazmarek.com -AlternateRecipient name@gmail.com -DeliverToBoth $true

*Note: The ‘$true’ on the end means it will leave a copy and forward. Change to ‘$false’ and it will only forward and not fill up mailbox.

*Note: If you want to remove a forwarder:

Clear-MSOnlineAlternateRecipient -Identity <email of hosted account>

Example: Clear-MSOnlineAlternateRecipient -Identity name@kazmarek.com

Connecting a Mobile device to Microsoft Exchange Online

Had some trouble recently getting clients setup with Microsoft Exchange Online services on a mobile device. Here’s the settings that worked for me.

IPhone
——
Email: user@domain.com
Server: red001.mail.microsoftonline.com (Do no included the HTTPS:\ portion of address)
Domain: Should be left blank
Username: user@domain.com
Password: ******** (The users BPOS/Exchange Online password)

Blackberry
——
Email account: user@domain.com
Web Access URL: https://red001.mail.microsoftonline.com/owa (be sure to include the https:// and trailing /owa)
Username: user@domain.com
Password: ******** (The users BPOS/Exchange Online password)
Mailbox Name: user (just the prefix of their email address)

BPOS – Exchange Hosted important Shell Commands

To add mailbox permissions to other users in Microsoft Exchange Hosted Services (BPOS).

Add-MSOnlineMailPermission -Identity user@example.com -TrustedUser admin@example.com –GrantFullAccess True –GrantSendAs True

http://technet.microsoft.com/en-us/library/ee662271.aspx

Get Mailbox size settings from Microsoft Exchange Hosted Services

Get-XsHostedExchangeMailbox -SourceServer red001.mail.microsoftonline.com -SourceIdentity user@domain.com -SourceAdminCredential $cred -SourceDetail Full

http://blogs.pointbridge.com/Blogs/schertz_jeff/Pages/Post.aspx?_ID=85 [Read more…]