Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Email - adding custom SMTP header to outgoing email

Former Member
0 Kudos

Hi gurus,

I would like to add arbitrary email headers to emails generated by custom ABAP in SAP. I have tried passing these in the i_header parameter when using method cl_document_bcs=>create_document to create the send document/email. However this doesn't seem to have the desired effect - the header data could not be found when I received the email.

Specifically I would like to add:

X-Message-Flag: Follow up

Reply-By: Mon, 30 Nov 2009 12:45:00 +0100

Does anyone know if it is possible in ABAP to explicitly add your own email headers?

Thanks in advance for any advice,

Richard

5 REPLIES 5

Former Member
0 Kudos

Hi,

In Standard SAP, the standard function modules responsible for email header and then sending the mail is, 'ADDR_GET_NEXT_COMM_TYPE'.

Import parameters of this function module is holding the subject, reciever etc.

So put a break point at this function module in update mode switched and check where exactly it got triggerred and try replacing the same with custom include if possible.

It works.........

Former Member
0 Kudos

Hi Richard,

I have asked a similar question over at this thread:

[|]

Have you determined whether it is possible to add additional SMTP headers to SAP-generated emails?

The recommendation from Santhosh re. FM 'ADDR_GET_NEXT_COMM_TYPE' doesn't appear to be suitable - there are no relevant parameters and standard send processing (via. SOST) does not use this FM.

Regards

Hagen

0 Kudos

This message was moderated.

0 Kudos

Email headers are constructed in the following location:

Class: cl_bcom_mime_message_smtp

Method: add_header

add_header is a protected instance method, so cannot be called from any class not inheriting from cl_bcom_mime_message_smtp. However, cl_bcom_mime_message_smtp is declared Final... that is, no class can inherit from it.

In order to add custom SMTP headers, you'd need to add an implicit enhancement at the end of the method.

Hope it's of use.

0 Kudos

Hi Hagen,

did you solve it without adding an implicit enhancement?

it's seems there are no possibilities to add custom header fields with standard CL_BCS..