Sending mail from SAP
September 29, 2008The ability to send and receive e-mail is critical to any CRM system. Sending e-mail from SAP is really simple, but battling the network administrators can sometimes be challenge.
In this post I want to show how to technically configure sending of mail from a SAP Server running Linux with Postfix. I have not used Microsoft Exchange(so won’t try to describe here), but the concept is the same. In future, I will describe the receiving of mail into SAP and the configuration required to send and receive CRM WebClient mail.
With WAS 6.10 the SAP system contains its own SMTP Server. In theory the SAP SMTP Server can be used to send and receive mail on the Internet, but in practice you probably don’t want to do this due to following reasons:
- Exposing your SAP System directly to the Internet is a security risk.
- Normally you only want 1 or 2 addresses to be used by SAP and these must use the corporate domain. You don’t want all your corporate mail to come into SAP.
- The standard SMTP port required for sending Internet mail is 25. On Unix systems, root privileges is required to start services that listen on port 25. The SAP System runs with normal user rights, therefore it can’t start the SMTP server on port 25. Unless you use icmbnd.
The receiving of mail will be tackled later, but if you ever want to receive mail you must configure your sending addresses in such a way that receiving will be possible in future. Therefore, I need to create an internal mail domain(I don’t really need to do this for sending, but its the slick way).
The diagram below describes the end state we want to achieve.
Postfix Setup
Install Postfix or another SMTP Server on the SAP Server or another machine in the network. The SMTP server will run on Port 25 and will relay the mail from SAP to the world. Typically you would reuse your existing corporate SMTP server.
Importantly, you have to allow the SAP Server to relay mail via Postfix. This is done by adding the IP address(e.g. 10.20.30.40) of the SAP Server to the mynetworks spefication in the main.cf file(located in /etc/postfix on suse).
mynetworks = 10.20.30.40, [rest of what was there before]
Also, SAP will send the mail from crm@sap.company.local, but we want to change that to crm@company.com. You achieve this by maintaining a mapping in the sender_canonical file in /etc/postfix. The line below shows the entry to be maintained.
@sap.company.local @company.com
Once the above change has been made the postmap command below must be run in configuration directory to create the lookup file./etc/postfix> postmap sender_canonical
SAP Setup
Here all the setup is done in transaction /nSCOT. You must point the SMTP node to the Postfix server and activate it. Double click on the smtp node as shown below.
The 2 important settings to maintain is Mail Host(the IP address of your Postfix server) and the node in use tick.
You must also maintain the Default Mail domain(very important) under Settings->Default Domain to crm@sap.company.local. The nasty way to configure this is to simply send mail from crm@company.com, in which case you don’t need the Postfix sender mapping.
You must now schedule a periodic job to send e-mail from SAP. This can be done by going to Settings->Send Jobs. In the popup select “Schedule Job for INT”, the pop up below will allow you to schedule this job. E-mails will be sent periodically every time this job runs.
Finally, make sure that you have an e-mail address maintained(e.g. user@sap.company.local) in transaction SU01 for your user.
You can now goto system->short message and test sending an e-mail to an external address.









