04-13-2009 7:56 PM
hello , i do a program that convert a smartforms to pdf and attach it to a email and send it , the thing is convert and attach step are doing just fine but the sending of it is failing or not failing but not working properly because i can see the emails in the send item folder in the bussiness workplace ( tcode swbp ) but dont get send.
pd: if i go to swbp and choose the email from send item folder and press send , type a email that a user in sap have how they internet address the email get send but if i type other random address i get a error like :
13.04.2009 15:01:49 SX_PERFORM_SMTPSEND G 802 = 550 5.7.1 Unable to relay for 'randomhereemailaddress'
thanks
04-13-2009 8:10 PM
04-13-2009 8:49 PM
>
> Hi,
>
this not point me to anywhere , i already get the smartform convert to pdf and get attach to the email and get send too , now my problem is using a email address that not are define in any sap user like the email address of the customer define in xd02 tcode ( i use some select to get this address in the table adrc )
04-13-2009 8:45 PM
i solve the problem of immediate sending of the email by add in the export of SO_NEW_DOCUMENT_ATT_SEND_API1 FM
COMMIT_WORK = 'X'
and now the email get send right way but using a address that not belong to a user create in sap dont work
04-13-2009 8:56 PM
Hi,
If you want to send to the sap user then you need to populate the
i_reclist-receiver = <SAP USER ID>.
i_reclist-rec_type = 'B'.
append i_reclist.
and pass to the RECEIVERS in the FM
04-13-2009 8:59 PM
>
> Hi,
>
> If you want to send to the sap user then you need to populate the
>
i_reclist-receiver = <SAP USER ID>. > i_reclist-rec_type = 'B'. > append i_reclist.
>
> and pass to the RECEIVERS in the FM
i want send to other email address not to a sap user , what i say in my post was that i only get the email send to email address that are define like internet address in the sap user
thanks anyway
still waiting for ideas
04-15-2009 1:10 PM
hello , i get solve my problem , how i say i was able to send email only to the Internet address define in the sap user , but that was not all true the thing was that this address was all of the same domain of the email server but when i try different address ( outside of the domain , example someaddress at something dot com ) i get a error when i saw the log i see the was a relay error so that point me direct to the email server ( was a exchange server ) so check the config of it ( email server ) and allow the sap server do relay on it and that was it , now i can send email to any email address without problem.
pd: i can not find a link of tutorial that explain how allow the relay in exchange server 2003 ( what was i have ) but if somebody need it contact me via email and i will it happy to send ot it some screenshots and little explain of how do it.
04-13-2009 8:49 PM
Hi ,
If in your system had Unix..
this function module use to help attachment to external and internal mials..
FUNCTION z_unix_mail_mutt.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(UX_RECEIVERS) TYPE CHAR512
*" VALUE(UX_SUBJECT) LIKE ZUXBODY-TEXT
*" VALUE(UX_FROM) LIKE ZUXBODY-TEXT OPTIONAL
*" VALUE(UX_FILE_NAME) LIKE ZUXBODY-TEXT OPTIONAL
*" VALUE(UX_FILE_NAME_PDF) LIKE ZUXBODY-TEXT OPTIONAL
*" VALUE(UX_FILE_NAME_TXT) LIKE ZUXBODY-TEXT OPTIONAL
*" VALUE(UX_RECEIVERS_CC) TYPE CHAR512 OPTIONAL
*" TABLES
*" UX_LINES STRUCTURE ZUXBODY
*" UX_DATA STRUCTURE ZUXDATA OPTIONAL
*" UX_DATA_TXT STRUCTURE ZUXDATA OPTIONAL
*" UX_DATA_PDF STRUCTURE TLINE OPTIONAL
*"----------------------------------------------------------------------
DATA: ux_file(100) TYPE c. " temp output file
DATA: ux_data_file(100) TYPE c.
data: ux_data_file_txt(100) type c. "BRB112205
DATA: ux_data_file_pdf(100) TYPE c.
DATA: ux_com(1200) TYPE c. " the unix command
DATA: l_timestamp LIKE tzonref-tstampl. " timestamp for unique file
GET TIME STAMP FIELD l_timestamp.
DATA: mynum(23) TYPE c. " string to build uniqe file name
mynum = l_timestamp.
mynum = mynum+8(14).
* don't send mail to null
IF ux_receivers = space.
EXIT.
ENDIF.
* create the unique file to hold the message body
* and transfer the body to it
CONCATENATE '/tmp/zuxmail' mynum INTO ux_file.
OPEN DATASET ux_file FOR OUTPUT IN TEXT MODE
ENCODING DEFAULT.
LOOP AT ux_lines.
TRANSFER ux_lines-text TO ux_file.
ENDLOOP.
CLOSE DATASET ux_file.
IF ux_file_name <> space.
CONCATENATE '/tmp/' ux_file_name '.csv' INTO ux_data_file.
OPEN DATASET ux_data_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
LOOP AT ux_data.
TRANSFER ux_data-text TO ux_data_file.
ENDLOOP.
CLOSE DATASET ux_data_file.
ENDIF.
* Add ability to save .txt files
if ux_file_name_txt <> space.
concatenate '/tmp/' ux_file_name_txt '.txt' into ux_data_file_txt.
open dataset ux_data_file_txt for output in text mode
encoding default.
loop at ux_data_txt.
transfer ux_data_txt-text to ux_data_file_txt.
endloop.
close dataset ux_data_file_txt.
endif.
IF ux_file_name_pdf <> space.
CONCATENATE '/tmp/' ux_file_name_pdf '.pdf' INTO ux_data_file_pdf.
OPEN DATASET ux_data_file_pdf FOR OUTPUT IN BINARY MODE.
LOOP AT ux_data_pdf.
TRANSFER ux_data_pdf TO ux_data_file_pdf.
ENDLOOP.
CLOSE DATASET ux_data_file_pdf.
ENDIF.
CONCATENATE
'cat'
ux_file
'| /opt/mutt/bin/mutt'
INTO ux_com SEPARATED BY space.
IF ux_file_name <> space.
CONCATENATE ux_com
'-a'
ux_data_file
INTO ux_com SEPARATED BY space.
ENDIF.
if ux_file_name_txt <> space.
concatenate ux_com
'-a'
ux_data_file_txt
into ux_com separated by space.
endif.
IF ux_file_name_pdf <> space.
CONCATENATE ux_com
'-a'
ux_data_file_pdf
INTO ux_com SEPARATED BY space.
ENDIF.
IF ux_receivers_cc IS INITIAL.
CONCATENATE
ux_com
'-s "'
ux_subject
'"'
' '
ux_receivers
INTO ux_com SEPARATED BY space.
ELSE.
CONCATENATE
ux_com
'-c'
ux_receivers_cc
'-s "'
ux_subject
'"'
' '
ux_receivers
INTO ux_com SEPARATED BY space.
ENDIF.
OPEN DATASET '/dev/null' FOR OUTPUT FILTER ux_com
IN TEXT MODE ENCODING DEFAULT.
CATCH SYSTEM-EXCEPTIONS file_access_errors = 5.
CLOSE DATASET '/dev/null'.
ENDCATCH.
CONCATENATE
'rm'
ux_file
INTO ux_com SEPARATED BY space.
OPEN DATASET '/dev/null' FOR OUTPUT FILTER ux_com
IN TEXT MODE ENCODING NON-UNICODE.
CATCH SYSTEM-EXCEPTIONS file_access_errors = 5.
CLOSE DATASET '/dev/null'.
ENDCATCH. "CL072803
IF ux_file_name <> space.
CONCATENATE
'rm'
ux_data_file
INTO ux_com SEPARATED BY space.
OPEN DATASET '/dev/null' FOR OUTPUT FILTER ux_com
IN TEXT MODE ENCODING DEFAULT.
CATCH SYSTEM-EXCEPTIONS file_access_errors = 5.
CLOSE DATASET '/dev/null'.
ENDCATCH.
ENDIF.
IF ux_file_name_txt <> space.
CONCATENATE
'rm'
ux_data_file_txt
INTO ux_com SEPARATED BY space.
OPEN DATASET '/dev/null' FOR OUTPUT FILTER ux_com
IN TEXT MODE ENCODING DEFAULT.
CATCH SYSTEM-EXCEPTIONS file_access_errors = 5.
CLOSE DATASET '/dev/null'.
ENDIF.
IF ux_file_name_pdf <> space.
CONCATENATE
'rm'
ux_data_file_pdf
INTO ux_com SEPARATED BY space.
OPEN DATASET '/dev/null' FOR OUTPUT FILTER ux_com
IN TEXT MODE ENCODING DEFAULT.
CATCH SYSTEM-EXCEPTIONS file_access_errors = 5.
CLOSE DATASET '/dev/null'.
ENDCATCH.
ENDIF.
ENDFUNCTION.
Regrads,
Prabhudas
04-13-2009 8:51 PM
>
> Hi ,
>
> If in your system had Unix..
>
> this function module use to help attachment to external and internal mials..
>
>
> FUNCTION z_unix_mail_mutt. > *"---------------------------------------------------------------------- > *"*"Local Interface: > *" IMPORTING > *" VALUE(UX_RECEIVERS) TYPE CHAR512 > *" VALUE(UX_SUBJECT) LIKE ZUXBODY-TEXT > *" VALUE(UX_FROM) LIKE ZUXBODY-TEXT OPTIONAL > *" VALUE(UX_FILE_NAME) LIKE ZUXBODY-TEXT OPTIONAL > *" VALUE(UX_FILE_NAME_PDF) LIKE ZUXBODY-TEXT OPTIONAL > *" VALUE(UX_FILE_NAME_TXT) LIKE ZUXBODY-TEXT OPTIONAL > *" VALUE(UX_RECEIVERS_CC) TYPE CHAR512 OPTIONAL > *" TABLES > *" UX_LINES STRUCTURE ZUXBODY > *" UX_DATA STRUCTURE ZUXDATA OPTIONAL > *" UX_DATA_TXT STRUCTURE ZUXDATA OPTIONAL > *" UX_DATA_PDF STRUCTURE TLINE OPTIONAL > *"---------------------------------------------------------------------- > > DATA: ux_file(100) TYPE c. " temp output file > DATA: ux_data_file(100) TYPE c. > data: ux_data_file_txt(100) type c. "BRB112205 > DATA: ux_data_file_pdf(100) TYPE c. > DATA: ux_com(1200) TYPE c. " the unix command > DATA: l_timestamp LIKE tzonref-tstampl. " timestamp for unique file > GET TIME STAMP FIELD l_timestamp. > DATA: mynum(23) TYPE c. " string to build uniqe file name > > mynum = l_timestamp. > mynum = mynum+8(14). > > * don't send mail to null > IF ux_receivers = space. > EXIT. > ENDIF. > > > * create the unique file to hold the message body > * and transfer the body to it > CONCATENATE '/tmp/zuxmail' mynum INTO ux_file. > > OPEN DATASET ux_file FOR OUTPUT IN TEXT MODE > ENCODING DEFAULT. > LOOP AT ux_lines. > TRANSFER ux_lines-text TO ux_file. > ENDLOOP. > CLOSE DATASET ux_file. > > IF ux_file_name <> space. > CONCATENATE '/tmp/' ux_file_name '.csv' INTO ux_data_file. > OPEN DATASET ux_data_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT. > LOOP AT ux_data. > TRANSFER ux_data-text TO ux_data_file. > ENDLOOP. > CLOSE DATASET ux_data_file. > ENDIF. > > * Add ability to save .txt files > if ux_file_name_txt <> space. > concatenate '/tmp/' ux_file_name_txt '.txt' into ux_data_file_txt. > open dataset ux_data_file_txt for output in text mode > encoding default. > loop at ux_data_txt. > transfer ux_data_txt-text to ux_data_file_txt. > endloop. > close dataset ux_data_file_txt. > endif. > > IF ux_file_name_pdf <> space. > CONCATENATE '/tmp/' ux_file_name_pdf '.pdf' INTO ux_data_file_pdf. > OPEN DATASET ux_data_file_pdf FOR OUTPUT IN BINARY MODE. > LOOP AT ux_data_pdf. > TRANSFER ux_data_pdf TO ux_data_file_pdf. > ENDLOOP. > CLOSE DATASET ux_data_file_pdf. > ENDIF. > > > CONCATENATE > 'cat' > ux_file > '| /opt/mutt/bin/mutt' > INTO ux_com SEPARATED BY space. > > > IF ux_file_name <> space. > CONCATENATE ux_com > '-a' > ux_data_file > INTO ux_com SEPARATED BY space. > ENDIF. > if ux_file_name_txt <> space. > concatenate ux_com > '-a' > ux_data_file_txt > into ux_com separated by space. > endif. > IF ux_file_name_pdf <> space. > CONCATENATE ux_com > '-a' > ux_data_file_pdf > INTO ux_com SEPARATED BY space. > ENDIF. > > > IF ux_receivers_cc IS INITIAL. > CONCATENATE > ux_com > '-s "' > ux_subject > '"' > ' ' > ux_receivers > INTO ux_com SEPARATED BY space. > ELSE. > CONCATENATE > ux_com > '-c' > ux_receivers_cc > '-s "' > ux_subject > '"' > ' ' > ux_receivers > INTO ux_com SEPARATED BY space. > ENDIF. > > OPEN DATASET '/dev/null' FOR OUTPUT FILTER ux_com > IN TEXT MODE ENCODING DEFAULT. > CATCH SYSTEM-EXCEPTIONS file_access_errors = 5. > CLOSE DATASET '/dev/null'. > ENDCATCH. > CONCATENATE > 'rm' > ux_file > INTO ux_com SEPARATED BY space. > > > OPEN DATASET '/dev/null' FOR OUTPUT FILTER ux_com > IN TEXT MODE ENCODING NON-UNICODE. > CATCH SYSTEM-EXCEPTIONS file_access_errors = 5. > CLOSE DATASET '/dev/null'. > ENDCATCH. "CL072803 > > IF ux_file_name <> space. > > CONCATENATE > 'rm' > ux_data_file > INTO ux_com SEPARATED BY space. > > OPEN DATASET '/dev/null' FOR OUTPUT FILTER ux_com > IN TEXT MODE ENCODING DEFAULT. > CATCH SYSTEM-EXCEPTIONS file_access_errors = 5. > CLOSE DATASET '/dev/null'. > ENDCATCH. > ENDIF. > > IF ux_file_name_txt <> space. > > CONCATENATE > 'rm' > ux_data_file_txt > INTO ux_com SEPARATED BY space. > > OPEN DATASET '/dev/null' FOR OUTPUT FILTER ux_com > IN TEXT MODE ENCODING DEFAULT. > CATCH SYSTEM-EXCEPTIONS file_access_errors = 5. > CLOSE DATASET '/dev/null'. > ENDIF. > > > IF ux_file_name_pdf <> space. > > CONCATENATE > 'rm' > ux_data_file_pdf > INTO ux_com SEPARATED BY space. > > > OPEN DATASET '/dev/null' FOR OUTPUT FILTER ux_com > IN TEXT MODE ENCODING DEFAULT. > CATCH SYSTEM-EXCEPTIONS file_access_errors = 5. > CLOSE DATASET '/dev/null'. > ENDCATCH. > ENDIF. > ENDFUNCTION. >
>
> Regrads,
> Prabhudas
Thanks but i need use the smtp ( exchange ) if is posible , i will use that option if i dont find any other
thanks again ..
Still waiting for some ideas
Edited by: Edgar Almonte on Apr 13, 2009 9:56 PM
04-13-2009 8:51 PM
Hi ,
If in your system had Unix..
this function module use to help attachment to external and internal mials..
*"*"Local Interface:
*" IMPORTING
*" VALUE(UX_RECEIVERS) TYPE CHAR512
*" VALUE(UX_SUBJECT) LIKE ZUXBODY-TEXT
*" VALUE(UX_FROM) LIKE ZUXBODY-TEXT OPTIONAL
*" VALUE(UX_FILE_NAME) LIKE ZUXBODY-TEXT OPTIONAL
*" VALUE(UX_FILE_NAME_PDF) LIKE ZUXBODY-TEXT OPTIONAL
*" VALUE(UX_FILE_NAME_TXT) LIKE ZUXBODY-TEXT OPTIONAL
*" VALUE(UX_RECEIVERS_CC) TYPE CHAR512 OPTIONAL
*" TABLES
*" UX_LINES STRUCTURE ZUXBODY
*" UX_DATA STRUCTURE ZUXDATA OPTIONAL
*" UX_DATA_TXT STRUCTURE ZUXDATA OPTIONAL
*" UX_DATA_PDF STRUCTURE TLINE OPTIONAL
DATA: ux_file(100) TYPE c.
DATA: ux_data_file(100) TYPE c.
data: ux_data_file_txt(100) type c.
DATA: ux_data_file_pdf(100) TYPE c.
DATA: ux_com(1200) TYPE c.
DATA: l_timestamp LIKE tzonref-tstampl.
GET TIME STAMP FIELD l_timestamp.
DATA: mynum(23) TYPE c.
mynum = l_timestamp.
mynum = mynum+8(14).
* don't send mail to null
IF ux_receivers = space.
EXIT.
ENDIF.
CONCATENATE '/tmp/zuxmail' mynum INTO ux_file.
OPEN DATASET ux_file FOR OUTPUT IN TEXT MODE
ENCODING DEFAULT.
LOOP AT ux_lines.
TRANSFER ux_lines-text TO ux_file.
ENDLOOP.
CLOSE DATASET ux_file.
IF ux_file_name <> space.
CONCATENATE '/tmp/' ux_file_name '.csv' INTO ux_data_file.
OPEN DATASET ux_data_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
LOOP AT ux_data.
TRANSFER ux_data-text TO ux_data_file.
ENDLOOP.
CLOSE DATASET ux_data_file.
ENDIF.
* Add ability to save .txt files
if ux_file_name_txt <> space.
concatenate '/tmp/' ux_file_name_txt '.txt' into ux_data_file_txt.
open dataset ux_data_file_txt for output in text mode
encoding default.
loop at ux_data_txt.
transfer ux_data_txt-text to ux_data_file_txt.
endloop.
close dataset ux_data_file_txt.
endif.
IF ux_file_name_pdf <> space.
CONCATENATE '/tmp/' ux_file_name_pdf '.pdf' INTO ux_data_file_pdf.
OPEN DATASET ux_data_file_pdf FOR OUTPUT IN BINARY MODE.
LOOP AT ux_data_pdf.
TRANSFER ux_data_pdf TO ux_data_file_pdf.
ENDLOOP.
CLOSE DATASET ux_data_file_pdf.
ENDIF.
CONCATENATE
'cat'
ux_file
'| /opt/mutt/bin/mutt'
INTO ux_com SEPARATED BY space.
IF ux_file_name <> space.
CONCATENATE ux_com
'-a'
ux_data_file
INTO ux_com SEPARATED BY space.
ENDIF.
if ux_file_name_txt <> space.
concatenate ux_com
'-a'
ux_data_file_txt
into ux_com separated by space.
endif.
IF ux_file_name_pdf <> space.
CONCATENATE ux_com
'-a'
ux_data_file_pdf
INTO ux_com SEPARATED BY space.
ENDIF.
IF ux_receivers_cc IS INITIAL.
CONCATENATE
ux_com
'-s "'
ux_subject
'"'
' '
ux_receivers
INTO ux_com SEPARATED BY space.
ELSE.
CONCATENATE
ux_com
'-c'
ux_receivers_cc
'-s "'
ux_subject
'"'
' '
ux_receivers
INTO ux_com SEPARATED BY space.
ENDIF.
OPEN DATASET '/dev/null' FOR OUTPUT FILTER ux_com
IN TEXT MODE ENCODING DEFAULT.
CATCH SYSTEM-EXCEPTIONS file_access_errors = 5.
CLOSE DATASET '/dev/null'.
ENDCATCH.
CONCATENATE
'rm'
ux_file
INTO ux_com SEPARATED BY space.
OPEN DATASET '/dev/null' FOR OUTPUT FILTER ux_com
IN TEXT MODE ENCODING NON-UNICODE.
CATCH SYSTEM-EXCEPTIONS file_access_errors = 5.
CLOSE DATASET '/dev/null'.
ENDCATCH.
IF ux_file_name <> space.
CONCATENATE
'rm'
ux_data_file
INTO ux_com SEPARATED BY space.
OPEN DATASET '/dev/null' FOR OUTPUT FILTER ux_com
IN TEXT MODE ENCODING DEFAULT.
CATCH SYSTEM-EXCEPTIONS file_access_errors = 5.
CLOSE DATASET '/dev/null'.
ENDCATCH.
ENDIF.
IF ux_file_name_txt <> space.
CONCATENATE
'rm'
ux_data_file_txt
INTO ux_com SEPARATED BY space.
OPEN DATASET '/dev/null' FOR OUTPUT FILTER ux_com
IN TEXT MODE ENCODING DEFAULT.
CATCH SYSTEM-EXCEPTIONS file_access_errors = 5.
CLOSE DATASET '/dev/null'.
ENDIF.
IF ux_file_name_pdf <> space.
CONCATENATE
'rm'
ux_data_file_pdf
INTO ux_com SEPARATED BY space.
OPEN DATASET '/dev/null' FOR OUTPUT FILTER ux_com
IN TEXT MODE ENCODING DEFAULT.
CATCH SYSTEM-EXCEPTIONS file_access_errors = 5.
CLOSE DATASET '/dev/null'.
ENDCATCH.
ENDIF.
Regrads,
Prabhudas