Sending emails from legacy printers, scanners, websites after migrating to Office 365

ad+1


I wrote a new blog on the same topic on August 28, 2016.  Read out here


SMTP Relays are what you need to setup if you are unable to send emails from your website, Bulk mailing solution, web-form, or any legacy line-of-business applications such as ERP, SAP, or CRM after migrating to Office 365.

SMTP (Simple Mail Transfer Protocol) is used when you set up an on-premises multi-function printer, scanner, fax, or line of business (LOB) application that needs to send email. If some or all of your mailboxes are in Office 365, there are a few options available: SMTP relay, client SMTP submission, or Direct Send.

  • SMTP Relay
    An SMTP relay is used to send mail from your organization by authenticating the IP address or certificate of the sender. Any email address (including non-Office365 mailboxes) can send mail using an SMTP relay, as long as it uses a domain that's set up as yours in Office 365.
PS: This method cannot be used with Azure or addresses on a Policy Block List (e.g. blocked IP address list)

  • Client SMTP Submission
    Client SMTP submission allows your device or LOB application to send emails using an email address associated with an Office 365 mailbox by authenticating itself using that account. Each device can have their own sender address or all devices can use one address such as printer@yourdomain.com

  • Direct Send
    Direct Send can be used if the device or LOB application has the ability to send mail by itself. If so, the device or LOB application does not use Office 365 to send the mail, but the mail is received by Office 365 for delivery to your Office 365 accounts.


Lets set up SMTP Relay, that is probably the easiest and most widely used method for relaying emails. 

First note that correct SMTP Setting for Outgoing emails are as under:

   Server name: smtp.office365.com
   Port: 587
   Encryption method: TLS 

If you are not able to connect using these setting then you can create SMTP replay between Office 365 and third application. To create SMPT Relay….

Step 1: Install IIS and SMTP
===============================================
Install Internet Information Services (IIS)
--------------------------------------------
In Windows Server 2012
1.     In Server Manager, select Add Roles.
2.     On the Before you begin page in the Add Roles Wizard, click Next.
3.     On the Select Installation Type page, select Role-based or Feature-based installation.
4.     On the Select destination server page, click Select a server from the server pool, and then select the server that will be running SMTP services. Then, click Next.
5.     On the Select Server Roles page, select Web Server (IIS), and then click Next. If a page that requests additional features is displayed, click Add Features, and then click Next.
6.     On the Select Role Services page, make sure that Basic Authentication under Security is selected, and then click Next.
7.     On the Confirm Installation Steps page, click Install.
In Windows Server 2008 R2
1.     In Server Manager, select Add Roles.
2.     In the Add Roles Wizard, on the Before you begin page, click Next.
3.     On the Select Server Roles page, select Web Server (IIS), and then click Install.
4.     Click Next until you get to the Select Role Services page.
5.     In addition to what is already selected, make sure that ODBC Logging, IIS Metabase Compatibility, and IIS 6 Management Console are selected, and then click Next.
6.     When you're prompted to install IIS, click Install. You may have to restart the server after the installation is finished.
Install SMTP
--------------------------------------------
1.     Open Server Manager, and then do one of the following, as appropriate for your situation:
In Windows Server 2012, click Add Roles and Features
In Windows Server 2008 R2, click Add Roles and Features.
2.     2. Do one of the following, as appropriate for your situation:
In Windows Server 2012, in the Add Roles and Features wizard, click Server Selection, make sure that the server that will be running the SMTP server is selected, and then click Features. On the Select Features screen, select SMTP Server. You may be prompted to install additional components. If this is the case, click Add Required Features and then click Next.
In Windows Server 2008, in the Select Features window, select SMTP Server. If you are prompted to install additional components, click Add Required Features and then click Next.
3.     3. Click Install.
4.     4. After the installation is finished, you may have to start the SMTP service by using the Services Microsoft Management Console (MMC) snap-in (Services.msc).
Step 2:Setup SMTP relay:
===============================================
1. Open Internet Information Services (IIS) 6.0.
2. Right click on the SMTP Virtual Server and select Properties
cid:image001.png@01CF192B.3AE29650
3. In General Tab, click Advanced
cid:image002.png@01CF192B.3AE29650
4. Make sure SMTP Port is 25
cid:image003.png@01CF192B.56807120
5. On Access Tab, click Authentication, checked Anonymous access
cid:image004.png@01CF192B.8D6F6650
6. If you want allow all devices connect to this SMTP server, click Connection, checked All except the list below
cid:image005.png@01CF192B.EAF9EED0
7.  Click Relay, checked All except the list below, tick Allow all computers which successfully authenticate to relay, regardless of the list above
cid:image006.png@01CF192C.5453B0A0
8. Click Delivery Tab, click Outbound Security..., select Basic authentication, type Office 365 account and password, checked TLS encryption
cid:image007.png@01CF192C.7B8171D0
9. Click Outbound connection.., make sure TCP port is 587
cid:image008.png@01CF1930.1B9AFB20
10. Click Advanced.., type the SMTP server full computer name in Fully-qualified domain name:
cid:image009.png@01CF1930.82F40AF0
11. Right click Domains, click New->Domain, select Remote domain
12. Type Office 365 account domain, and Finish
13. Double click remote domain, checked Allow incoming mail to be relayed to this domain, Forward all mail to smart host: smtp.office365.com
14. Click Outbound Security..., select Basic authentication, type Office 365 account and password, checked TLS encryption
Step 3: Test SMTP relay:
===============================================
1. Create an email.txt file with following content:
SUBJECT: Test email from SMTP
This is a test email sent from my SMTP server
2. Copy email.txt to C:\inetpub\mailroot\Pickup
3. After a while, the email will go to C:\inetpub\mailroot\Queue
4. After that, email will sent out, if email cannot send out, email will be moved to C:\inetpub\mailroot\Badmail, we can read the bad mail for more information.
Other information:
Success scenario SMTP log:
===============================================
#Software: Microsoft Internet Information Services 7.5
#Version: 1.0
#Date: 2014-01-24 08:01:45
#Fields: date time c-ip cs-username s-sitename s-computername s-ip s-port cs-method cs-uri-stem cs-uri-query sc-status sc-win32-status sc-bytes cs-bytes time-taken cs-version cs-host cs(User-Agent) cs(Cookie) cs(Referer)
2014-01-24 08:01:45 111.221.114.166 OutboundConnectionResponse SMTPSVC1 AALHUNG15 - 0 - - 220+HKNPR03CA006.outlook.office365.com+Microsoft+ESMTP+MAIL+Service+ready+at+Fri,+24+Jan+2014+08:01:38++0000 0 0 108 0 94 SMTP - - - -
2014-01-24 08:01:45 111.221.114.166 OutboundConnectionCommand SMTPSVC1 AALHUNG15 - 0 EHLO - AALHUNG15.Alfred-Hung.com.hk 0 0 4 0 94 SMTP - - - -
2014-01-24 08:01:45 111.221.114.166 OutboundConnectionResponse SMTPSVC1 AALHUNG15 - 0 - - 250-HKNPR03CA006.outlook.office365.com+Hello+[167.220.224.140] 0 0 62 0 187 SMTP - - - -
2014-01-24 08:01:45 111.221.114.166 OutboundConnectionCommand SMTPSVC1 AALHUNG15 - 0 STARTTLS - - 0 0 8 0 187 SMTP - - - -
2014-01-24 08:01:45 111.221.114.166 OutboundConnectionResponse SMTPSVC1 AALHUNG15 - 0 - - 220+2.0.0+SMTP+server+ready 0 0 27 0 281 SMTP - - - -
2014-01-24 08:01:45 111.221.114.166 OutboundConnectionCommand SMTPSVC1 AALHUNG15 - 0 EHLO - AALHUNG15.Alfred-Hung.com.hk 0 0 4 0 687 SMTP - - - -
2014-01-24 08:01:45 111.221.114.166 OutboundConnectionResponse SMTPSVC1 AALHUNG15 - 0 - - 250-HKNPR03CA006.outlook.office365.com+Hello+[167.220.224.140] 0 0 62 0 797 SMTP - - - -
2014-01-24 08:01:45 111.221.114.166 OutboundConnectionCommand SMTPSVC1 AALHUNG15 - 0 AUTH - - 0 0 4 0 797 SMTP - - - -
2014-01-24 08:01:45 111.221.114.166 OutboundConnectionResponse SMTPSVC1 AALHUNG15 - 0 - - 334+UGFzc3dvcmQ6 0 0 16 0 890 SMTP - - - -
2014-01-24 08:01:47 111.221.114.166 OutboundConnectionResponse SMTPSVC1 AALHUNG15 - 0 - - 235+2.7.0+Authentication+successful 0 0 35 0 2515 SMTP - - - -
2014-01-24 08:01:47 111.221.114.166 OutboundConnectionCommand SMTPSVC1 AALHUNG15 - 0 MAIL - FROM:<global@alhunge3.onmicrosoft.com>+SIZE=468 0 0 4 0 2515 SMTP - - - -
2014-01-24 08:01:47 111.221.114.166 OutboundConnectionResponse SMTPSVC1 AALHUNG15 - 0 - - 250+2.1.0+Sender+OK 0 0 19 0 2656 SMTP - - - -
2014-01-24 08:01:47 111.221.114.166 OutboundConnectionCommand SMTPSVC1 AALHUNG15 - 0 RCPT - TO:<global@alhunge3.onmicrosoft.com> 0 0 4 0 2656 SMTP - - - -
2014-01-24 08:01:47 111.221.114.166 OutboundConnectionResponse SMTPSVC1 AALHUNG15 - 0 - - 250+2.1.5+Recipient+OK 0 0 22 0 2781 SMTP - - - -
2014-01-24 08:01:47 111.221.114.166 OutboundConnectionCommand SMTPSVC1 AALHUNG15 - 0 BDAT - 468+LAST 0 0 4 0 2781 SMTP - - - -
2014-01-24 08:01:48 111.221.114.166 OutboundConnectionResponse SMTPSVC1 AALHUNG15 - 0 - - 250+2.6.0+<AALHUNG15FRaqbC8wSA00000002@AALHUNG15.Alfred-Hung.com.hk>+[InternalId=35235911696874,+Hostname=SIXPR03MB029.apcprd03.prod.outlook.com]+Queued+mail+for+delivery 0 0 170 0 3969 SMTP - - - -
2014-01-24 08:01:48 111.221.114.166 OutboundConnectionCommand SMTPSVC1 AALHUNG15 - 0 QUIT - - 0 0 4 0 3969 SMTP - - - -
2014-01-24 08:01:48 111.221.114.166 OutboundConnectionResponse SMTPSVC1 AALHUNG15 - 0 - - 221+2.0.0+Service+closing+transmission+channel 0 0 46 0 4094 SMTP - - - -

In more, I am sharing some articles with you. Kindly refer them of more help…

How to configure Internet Information Server (IIS) for relay with Office 365

SAP integration with Office 365 and SharePoint Online: Step-by-step

How to sync SAP data with Microsoft SharePoint and Office 365


If you have any questions and concerns please do not hesitate to contact me. Look forward to hearing from you.

0 comments:

I welcome you to write your comments here..