Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Multiple Mail sending

Hello Experts,

I am using a function module to send mails , i m able to send mail to single email id but when i try to send mail to multiple emailid

using structure SOMRECI1 programme executes but m not getting mails..... following is my code

TABLES : ZTOMAIL .

TYPES : BEGIN OF TY_TOMAIL,

TMAIL TYPE AD_SMTPADR,

END OF TY_TOMAIL.

DATA : IT_EMAILS TYPE STANDARD TABLE OF SOMLRECI1 ,

TO_MAIL TYPE STANDARD TABLE OF SOMLRECI1 ,

wa_tmail TYPE SOMLRECI1,

  • TO_MAIL TYPE STANDARD TABLE OF TY_TOMAIL ,

WA_MAIL TYPE ADR6-SMTP_AdDR,

wa TYPE c LENGTH 100,

WA_FMAIL TYPE ADR6-SMTP_ADDR,

IT_MAIL TYPE STANDARD TABLE OF SOMLRECI1 WITH HEADER LINE.

DATA : TOEMAIL TYPE ADR6-SMTP_ADDR,

FROMEMAIL TYPE ADR6-SMTP_ADDR ,

SUB TYPE SO_OBJ_DES,

RET TYPE SY-SUBRC,

I_TXT TYPE BCSY_TEXT OCCURS 0,

IT_TEXT TYPE BCSY_TEXT.

WA = ' CHECK WHEATHER SENT ON ALL MAIL OR NOT'.

APPEND WA TO IT_TEXT.

*

*SELECT RECEIVER REC_TYPE COM_TYPE FROM ZTOMAIL INTO TABLE to_MAIL.

*

wa_tMAIL-RECEIVER = 'reciever mail id1'.

wa_tMAIL-REC_TYPE = 'U'.

wa_tMAIL-COM_TYPE = 'INT'.

wa_tMAIL-NOTIF_DEL = 'X'.

wa_tMAIL-NOTIF_NDEL = 'X'.

APPEND wa_tMAIL to TO_MAIL.

wa_tMAIL-RECEIVER = 'reciever mail id2'.

wa_tMAIL-REC_TYPE = 'U'.

wa_tMAIL-COM_TYPE = 'INT'.

wa_tMAIL-NOTIF_DEL = 'X'.

wa_tMAIL-NOTIF_NDEL = 'X'.

APPEND wa_tMAIL to TO_MAIL.

WA_FMAIL = 'sender mail id'.

SUB = 'this mail is to check '.

CALL FUNCTION 'Z_SENDMAIL'

EXPORTING

FROMEMAIL = WA_FMAIL

  • TOEMAIL = wa_mail

SUBJECT = SUB

FLAG = 'X'

IMPORTING

RETURN_CODE = RET

TABLES

IT_TEXT = IT_TEXT

IT_EMAILS = TO_MAIL

.

iF SY-SUBRC = 0.

WRITE :/ 'done'.

ENDIF.

Former Member
Not what you were looking for? View more on this topic or Ask a question