Need to send a an Outlook attachment with an Email
Hello everyone ,
I have a requirement in which I need to send an attachment in a mail as an Outlook attachment. I have used the following code and i am wondering what I would need to change so that the Outlook attachment works fine -
public static void sendMessageWithAttachments(EmailPoller emailPoller,String body,String toAddresses,String ccAddresses,String subject, BlobDomain associatedEmail)
throws MessagingException,Exception {
Properties props = new Properties();
Session session = Session.getDefaultInstance(props, null);
MimeMessage message = new MimeMessage(session);
// Fill in header of the email
message.setSubject(subject);
message.setContent(message, "text/plain");
if ((toAddresses != null) && (toAddresses.trim().length() > 0)) {
message.addRecipient(Message.RecipientType.TO,
new InternetAddress(toAddresses));
if ((ccAddresses != null) && (ccAddresses.trim().length() > 0)) {
message.addRecipient(Message.RecipientType.CC,
new InternetAddress(ccAddresses));
// Create a multi-part to combine the Mime Body parts
Multipart multipart = new MimeMultipart();
// Create your new message part to set text inside email & add it to teh multipart
BodyPart messageBodyPart = new MimeBodyPart();
messageBodyPart.setText(body);
multipart.addBodyPart(messageBodyPart);
// Create and fill MimeBodyPart for the attached content& add to multi part
messageBodyPart = new MimeBodyPart();
DataSource source = new ByteArrayDataSource(associatedEmail.toByteArray(),"text/plain");
messageBodyPart.setDataHandler(new DataHandler(source));
messageBodyPart.setFileName("associatedEmail.txt");
multipart.addBodyPart(messageBodyPart);
// Associate the multi-part with message content
message.setContent(multipart,"text/html");
emailPoller.forwardMessage(message);//send email with attachments
}What I tried was to set the MIME-type for the datasource @
DataSource source = new ByteArrayDataSource(associatedEmail.toByteArray(),"text/plain");to application/vnd.ms-outlook but it does create an Outlook message as an atatchment but refuses to open it and shows an Error.
Anyone who know how to make it work please ?
Thanks a lot ... worked perfectly fine.
DataSource source = new ByteArrayDataSource(<BlobHavingEmailDetails>.toByteArray(),"message/rfc822");
messageBodyPart.setDataHandler(new DataHandler(source));
//etc ... attach MimeBodyPart to MimeMultiPart to send the message with Body & attachment.Yes I wanted to attach another complete message to another one.
Similar Messages
-
Want to Send smartform as pdf attachment with a Email to some mail id
Hi ,
I want to send a smartform as a PDF attachment with a mail to a mail id. And I can send a mail with the PDF attachment.
But I am not able to open the PDF. It is throwing some error (Adobe reader could not open u2018fileu2019 because it is either not a supported file type or because the file has been damaged (for example , it was sent as an email attachment and was not correctly decoded)).
By debugging I come to know that the file which is generating is in some encoding format.
Please help me regard this. This is very urgent.
here is the code,
Main Program :
REPORT Ztest_report.
*--Top Include for Global Data Declarations.
INCLUDE ztest_report_top.
*--Form Include for Form Routines.
INCLUDE ztest_report_form.
START-OF-SELECTION.
START-OF-SELECTION.
*--Display data
Perform display_data.
END-OF-SELECTION.
Top declaration :
Internal table
DATA : i_otfdata TYPE tsfotf, " Smart Forms: Table OTF
i_tline TYPE TABLE OF tline WITH HEADER LINE,
i_receivers TYPE TABLE OF somlreci1 WITH HEADER LINE,
i_record LIKE solisti1 OCCURS 0 WITH HEADER LINE,
Objects to send mail.
i_objpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
i_objtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE,
i_objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE,
i_reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
Work Area declarations
w_mailaddr TYPE ppfdmailad,
w_mailtype TYPE so_escape,
w_mailrecipient TYPE swotobjid,
w_control TYPE ssfctrlop,
w_compop TYPE ssfcompop,
w_return TYPE ssfcrescl,
wa_doc_chng TYPE sodocchgi1,
w_data TYPE sodocchgi1,
wa_buffer TYPE string, "To convert from 132 to 255
wa_objhead TYPE soli_tab,
Variables declarations
v_form_name TYPE rs38l_fnam,
v_len_in LIKE sood-objlen,
v_len_out LIKE sood-objlen,
v_len_outn TYPE i,
v_lines_txt TYPE i,
v_lines_bin TYPE i.
Selection Screen
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-009.
PARAMETER: p_bukrs TYPE bukrs OBLIGATORY, "Company Code
p_belnr TYPE belnr_d OBLIGATORY, "Document No
p_gjahr TYPE gjahr OBLIGATORY, "document type
p_mailid(50) TYPE c OBLIGATORY.
"Mail Id
SELECTION-SCREEN END OF BLOCK blk1.
Form Logic :
FORM display_data.
*Local Variable declaration
DATA: lc_fm TYPE rs38l_fnam, "local variable to store the
l_i_document_output_info TYPE ssfcrespd,
l_i_struc_job_output_info TYPE ssfcrescl,
l_i_struc_job_output_options TYPE ssfcrescl,
i_lines TYPE TABLE OF tline WITH HEADER LINE,
lv_job_output_info TYPE ssfcrescl,
lv_document_output_info TYPE ssfcrespd,
lv_job_output_options TYPE ssfcresop,
lv_bin_filesize LIKE sood-objlen.
Determine the smartform name
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'ZTEST_SMARTFORM'
IMPORTING
fm_name = lc_fm
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
w_control-getotf = 'X'.
w_control-no_dialog = 'X'.
w_control-preview = space.
w_control-device = 'MAIL'.
Call the smartform and pass the selection screen parameter
CALL FUNCTION lc_fm
EXPORTING
control_parameters = w_control
output_options = w_compop
user_settings = 'X'
t_bukrs = p_bukrs
t_belnr = p_belnr
t_gjahr = p_gjahr
IMPORTING
job_output_info = l_i_struc_job_output_info
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Moving the Smart Forms: Table OTF into an internal table
i_otfdata[] = l_i_struc_job_output_info-otfdata[].
CONVERT TO OTF TO PDF.
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
IMPORTING
bin_filesize = lv_bin_filesize
TABLES
otf = i_otfdata
lines = i_lines
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
err_bad_otf = 4
OTHERS = 5.
IF sy-batch EQ l_c_no.
To directly view the print-preview in PDF format
CALL FUNCTION 'SSFCOMP_PDF_PREVIEW'
EXPORTING
i_otf = i_otfdata
EXCEPTIONS
convert_otf_to_pdf_error = 1
cntl_error = 2
OTHERS = 3.
For Sending the PDF file to a Mail ID.
LOOP AT i_lines.
TRANSLATE i_lines USING '~'.
CONCATENATE wa_buffer i_lines INTO wa_buffer.
ENDLOOP.
TRANSLATE wa_buffer USING '~'.
DO.
i_record = wa_buffer.
APPEND i_record.
SHIFT wa_buffer LEFT BY 255 PLACES.
IF wa_buffer IS INITIAL.
EXIT.
ENDIF.
ENDDO.
DATA: BEGIN OF zlines OCCURS 0,
tline TYPE char255,
END OF zlines.
*Change the PDF format from 132 to 255.
CALL FUNCTION 'SX_TABLE_LINE_WIDTH_CHANGE'
EXPORTING
transfer_bin = 'X'
TABLES
content_in = i_lines
content_out = zlines
EXCEPTIONS
err_line_width_src_too_long = 1
err_line_width_dst_too_long = 2
err_conv_failed = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Attachment
REFRESH: i_reclist,
i_objtxt,
i_objbin,
i_objpack.
CLEAR wa_objhead.
i_objbin[] = zlines[].
Create Message Body Title and Description
i_objtxt = 'test with pdf-Attachment!'.
APPEND i_objtxt.
DESCRIBE TABLE i_objtxt LINES v_lines_txt.
READ TABLE i_objtxt INDEX v_lines_txt.
wa_doc_chng-obj_name = 'smartform'.
wa_doc_chng-expiry_dat = sy-datum + 10.
wa_doc_chng-obj_descr = 'smartform'.
wa_doc_chng-sensitivty = 'F'.
wa_doc_chng-doc_size = v_lines_txt * 255.
Main Text
CLEAR i_objpack-transf_bin.
i_objpack-head_start = 1.
i_objpack-head_num = 1.
i_objpack-body_start = 2.
i_objpack-body_num = v_lines_txt.
i_objpack-doc_type = 'RAW'.
APPEND i_objpack.
Attachment (pdf-Attachment)
i_objpack-transf_bin = 'X'.
i_objpack-head_start = 1.
i_objpack-head_num = 1.
i_objpack-body_start = 2.
I_OBJPACK-DOC_TYPE = 'RAW'.
DESCRIBE TABLE i_objbin LINES v_lines_bin.
READ TABLE i_objbin INDEX v_lines_bin.
i_objpack-doc_size = v_lines_bin * 255 .
i_objpack-body_num = v_lines_bin.
i_objpack-doc_type = 'PDF'.
i_objpack-obj_name = 'smart'.
i_objpack-obj_descr = 'test'.
APPEND i_objpack.
CLEAR i_reclist.
i_reclist-receiver = p_mailid.
i_reclist-rec_type = 'U'.
APPEND i_reclist.
Send new document with attachments via RFC
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = wa_doc_chng
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = i_objpack
object_header = wa_objhead
contents_bin = i_objbin
contents_txt = i_objtxt
receivers = i_reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
IF sy-subrc <> 0.
WRITE:/ 'Error When Sending the File', sy-subrc.
ELSE.
WRITE:/ 'Mail sent'.
ENDIF.
ENDFORM. " display_datahi,
i wrote a programm.for me it is working.i think it will help for u.
DATA: t_otfdata TYPE ssfcrescl,
t_lines LIKE tline OCCURS 0 WITH HEADER LINE,
t_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,
t_RECORD LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE.
Objects to send mail.
DATA:T_OBJPACK LIKE SOPCKLSTI1 OCCURS 0 WITH HEADER LINE,
T_OBJTXT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
T_OBJBIN LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
T_RECLIST LIKE SOMLRECI1 OCCURS 0 WITH HEADER LINE.
DATA: w_filesize TYPE i,
w_bin_filesize TYPE i,
wa_ctrlop TYPE ssfctrlop,
wa_outopt TYPE ssfcompop,
WA_BUFFER TYPE STRING, "To convert from 132 to 255
WA_OBJHEAD TYPE SOLI_TAB,
WA_DOC_CHNG TYPE SODOCCHGI1,
W_DATA TYPE SODOCCHGI1.
DATA: form_name TYPE rs38l_fnam,
V_LINES_TXT TYPE I,
V_LINES_BIN TYPE I,
nast-spras type sy-langu value 'DE'.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = 'ZSR_DEMO1'
VARIANT = ' '
DIRECT_CALL = ' '
IMPORTING
FM_NAME = form_name
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
wa_ctrlop-LANGU = nast-spras.
wa_ctrlop-getotf = 'X'.
wa_ctrlop-no_dialog = 'X'.
wa_outopt-tdnoprev = 'X'.
CALL FUNCTION form_name
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS = wa_ctrlop
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
OUTPUT_OPTIONS = wa_outopt
USER_SETTINGS = 'X'
IMPORTING
DOCUMENT_OUTPUT_INFO =
JOB_OUTPUT_INFO = t_otfdata
JOB_OUTPUT_OPTIONS =
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
t_otf[] = t_otfdata-otfdata[].
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
FORMAT = 'PDF'
MAX_LINEWIDTH = 132
ARCHIVE_INDEX = ' '
COPYNUMBER = 0
ASCII_BIDI_VIS2LOG = ' '
PDF_DELETE_OTFTAB = ' '
IMPORTING
BIN_FILESIZE = w_bin_filesize
BIN_FILE =
TABLES
OTF = t_otf
LINES = t_lines
EXCEPTIONS
ERR_MAX_LINEWIDTH = 1
ERR_FORMAT = 2
ERR_CONV_NOT_POSSIBLE = 3
ERR_BAD_OTF = 4
OTHERS = 5
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
loop at t_lines.
TRANSLATE t_lines USING '~'.
CONCATENATE WA_BUFFER T_LINES INTO WA_BUFFER.
ENDLOOP.
TRANSLATE WA_BUFFER USING '~'.
DO.
t_RECORD = WA_BUFFER.
APPEND t_RECORD.
SHIFT WA_BUFFER LEFT BY 255 PLACES.
IF WA_BUFFER IS INITIAL.
EXIT.
ENDIF.
ENDDO.
Attachment
REFRESH: T_RECLIST,
T_OBJTXT,
T_OBJBIN,
T_OBJPACK.
CLEAR WA_OBJHEAD.
T_OBJBIN[] = T_RECORD[].
Create Message Body Title and Description
T_OBJTXT = 'test with pdf-Attachment!'.
APPEND T_OBJTXT.
DESCRIBE TABLE T_OBJTXT LINES V_LINES_TXT.
READ TABLE T_OBJTXT INDEX V_LINES_TXT.
WA_DOC_CHNG-OBJ_NAME = 'smartform'.
WA_DOC_CHNG-EXPIRY_DAT = SY-DATUM + 10.
WA_DOC_CHNG-OBJ_DESCR = 'smartform'.
WA_DOC_CHNG-SENSITIVTY = 'F'.
WA_DOC_CHNG-DOC_SIZE = V_LINES_TXT * 255.
Main Text
CLEAR T_OBJPACK-TRANSF_BIN.
T_OBJPACK-HEAD_START = 1.
T_OBJPACK-HEAD_NUM = 0.
T_OBJPACK-BODY_START = 1.
T_OBJPACK-BODY_NUM = V_LINES_TXT.
T_OBJPACK-DOC_TYPE = 'RAW'.
APPEND T_OBJPACK.
Attachment (pdf-Attachment)
T_OBJPACK-TRANSF_BIN = 'X'.
T_OBJPACK-HEAD_START = 1.
T_OBJPACK-HEAD_NUM = 0.
T_OBJPACK-BODY_START = 1.
DESCRIBE TABLE T_OBJBIN LINES V_LINES_BIN.
READ TABLE T_OBJBIN INDEX V_LINES_BIN.
T_OBJPACK-DOC_SIZE = V_LINES_BIN * 255 .
T_OBJPACK-BODY_NUM = V_LINES_BIN.
T_OBJPACK-DOC_TYPE = 'PDF'.
T_OBJPACK-OBJ_NAME = 'smart'.
T_OBJPACK-OBJ_DESCR = 'test'.
APPEND T_OBJPACK.
CLEAR T_RECLIST.
T_RECLIST-RECEIVER = 'mail id'.
T_RECLIST-REC_TYPE = 'U'.
APPEND T_RECLIST.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = WA_DOC_CHNG
PUT_IN_OUTBOX = 'X'
COMMIT_WORK = 'X'
TABLES
PACKING_LIST = T_OBJPACK
OBJECT_HEADER = WA_OBJHEAD
CONTENTS_BIN = T_OBJBIN
CONTENTS_TXT = T_OBJTXT
RECEIVERS = T_RECLIST
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
DOCUMENT_TYPE_NOT_EXIST = 3
OPERATION_NO_AUTHORIZATION = 4
PARAMETER_ERROR = 5
X_ERROR = 6
ENQUEUE_ERROR = 7
OTHERS = 8.
IF SY-SUBRC <> 0.
WRITE:/ 'Error When Sending the File', SY-SUBRC.
ELSE.
WRITE:/ 'Mail sent'.
ENDIF.
please reward me if helpful. -
Convert XSTRING to PDF Format and Send it as an attachment with work-item
I have an Adobe Form data available in the ECC system in XSTRING format. In one of my ABAP methods (used by a custom workflow task), i want to convert the XSTRING data in PDF format and send it as an attachment with a work-item. How best can this be done?
Appreciate any ideas,
SaurabhHi Saurabh,
if u want to download pdf which is in xstring format to u r local system
u can try the following code.
data: data_tab type table of x255.
call function 'SCMS_XSTRING_TO_BINARY'
exporting
buffer = XString data
tables
binary_tab = data_tab.
cl_gui_frontend_services=>gui_download(
exporting
filename = filename
filetype = 'BIN'
changing
data_tab = data_tab ).
cl_gui_frontend_services=>execute(
exporting
document = filename ).
Regards,
Chandru -
Reg: PO release notification needs to send to the PR Creater with PO num
HI Gurus,
Iam new to workfow. I have one senario in workflow.
Requirement: when ever PO release notification needs to send to the PR Creater with PO number and corresponding PR number.
Please guide how to do this .
My questions :
1.How can we can get the PR Creater user id to send notification mail
Thanks & Regards
RameshHi Ramesh ,
Which workflow you are using for PO . If it is the standard one , there is a rule used in the worklfow called 20000027.
In this there is an USer exit . In this exit , you can write your code for sending the workitem to the PR creator.
If you are using a custom workflow for this , then create a new rule and in that write the code for fetching the PR Creator and assign the user ro the actor tab. Incluse this rule in ur task .
This will solve your problem. -
I updated my iPhone 4S weeks ago and today it said I needed to update it again, so I did. Now when I send iMessage it comes up with my email address and not my number. How do I fix this?
The Snow Leopard 10.6 DVD should still be available from Apple for $20. You will have to call Apple Customer Care 1-800-692-7753 or 1-800-676-2775 to purchase it. It may still be in the Legacy Products list. The App Store which is required to download 10.7 or 10.8 is part of the 10.6.6 update.
If they no longer have any in stock you will have to buy it from eBay or Apple resellers that still have stock. But you will have to pay a premium since the DVDs are no longer being made. Snow Leopard DVDs are already up to $100 on Amazon.
http://www.ebay.com/sch/i.html?_nkw=10.6+snow+leopard&_sacat=0&_odkw=mac+os+10.6 &_osacat=0 -
SMS's that i send show up to recievers with my email instead of my name
HI
SMS's that i send show up to recievers with my email instead of my name
can ANYONE help please!!The Caller ID setting determines how your message will be received by others. If you select your number there, your message will be identified by your number to the recipient, and if they have your name and number in their contacts it will display your name. The Receive At setting only shows the ways others can address messages to you, such as by your phone number or email address. (Your number shown in Receive At can't be selected because you can't be changed or removed.)
-
How do I send docs to multiple signators with different email addresses on Echo sign ?
How do I send docs to multiple signators with different email addresses on Echo sign ?
Thanks man...the problem could be on the signators side.
Rick Schell...Realtor, ABR
www.rick-the-realtor.com
Cell 615-804-3085
Crye-Leike Realtors
Office 615-373-3513
Fax 615-373-5228
Quoting Echosign-Rob <[email protected]>:
Echosign-Rob created
the discussion
"How do I send docs to multiple signators with different email
addresses on Echo sign ?"
To view the discussion, visit:
https://forums.adobe.com/message/6395941#6395941
> -
Sending payslip as a PDF attachment with an email
Hi Experts,
I need to send an email with payslip as a PDF attachment. I wonder how this can be done for country China. The payroll driver program seems doesn't helps to send an email. Can any one tell me, if this can be achieved directly, else will have to write a code for the same.
Thanks.
Warm regards,
Harshad. MHi,
Here two Z-program needs to be develop.One program is to convert payslip into PDF file & store the PDF file in a folder where you send as an E-Mail.
Then create a spool request in Remunation statement. Maintain the Mail id's in Inftype-105.
Develop one Z program which will Send Email with PDF attachment.
Run this program the second screen will display where you have to attach the spool request no & the mail ID. Then execute the program to send as email.
Snita -
Send Invoice as PDF Attachment with variable Filename
Hello!
We got a requirement from one customer. We should send our invoices as PDF-Attachment via E-Mail but the attachment must have a variable filename. At the Moment we can send invoice as PDF-Attachment but only with a fix filename.
How can we change the filename in our Adobe Forms?
Best Regards
MarkusHi Florian!
Answer 1:
The original Name is Druckdaten.pdf
Answer 2:
Our entry in NAST-NACHA = 1
Answer 3:
I can implement some ABAP-Code
Here some Screenshots:
Configuration of printer E-MAIL:
Best regards
Markus -
Why can't I send an attachment with an email on IPad?
There doesn't seem to be a way in mail to send an attachment. I'm baffled as to why Apple would leave this feature out!
I am using the mail app on my Macbook Pro with charter email. I click the paperclip. Choose the document. It shows up in my email. I click the paper airplane. Wait. Then get...
"Cannot send message using charter.net. Sending the message content to the server failed.Select a different outgoing mail server from the list below or try later to leave the message in your outbox until it can be sent."
Connection Doctor is all green.
Checked the SMPT server list and can't find a problem.
All other emails go through just fine.
I just upgraded to Mountain Lion and stay up date.
I remember this happening when I first got my Mac a few years ago and quit using the mail app. because I couldn't solve it. Now it is just driving me crazy. -
Unable to send Word document as attachment to an email
I have recently installed Microsoft Office Standard on my new laptap which runs Windows 7 Professional. When i am in Word and trying to send the document as an email attachment, I received an error dialogue box with the message "Word couldn't send
email because of MAPI failure: "Unspecified error"." I clicked on the help button and have tried all the steps but no avail.
The work around is to open Outlook and create an email with an attachment. This works BUT I would like to be able to use Word as it was designed. Anyone have a similar issue and suggested correction?
Thanks!Here is a simple solution sure to work.
1. Start
2. Search for Winword
3. Right Click Winword and choose properties ( I instead would choose open file location just to know where the rest of windows programs can be found. Once there, right click Winword again and choose properties.
4. Click compatabilty tab
5. Check run as administrator at the bottom
6. Apply
7. Do the same for all Office programs If so desired (on the same file location where you found winword just look for Excel, Powerpoint, etc. and make sure the file you choose is an application type file)
Jic, it is not obligatory to apply the above solution for to all Office programs. You can do it just to the ones you want to send email from. If you only need Word to have this functionality just do it for Winword and thats it. -
Sending report as an attachment to an email
Hi,
I need to send a report as an attachment via email using xml publisher. I created data definition, templates and could run a report. I do not know where to add the coding for sending the email? I found the following coding in developer guide:
<?xml version="1.0" encoding="UTF-8"?>
<xapi:requestset xmlns:xapi="http://xmlns.oracle.com/oxp/xapi">
<xapi:request select="/DATA/DEPTS/DEPT/EMPLOYEES/EMPLOYEE"> <! - Burst
on employee element - >
<xapi:delivery>
<xapi:email server="my.smtp.server" port="25"
from=" email@removed " reply-to ="">
<xapi:message id="123" to="${EMAIL}"
<! - Set the id for the delivery method - ><! - Use the employees
EMAIL element to email the document to
the employee - >cc="${ADMIN_EMAIL}"
<! - Use the ADMIN_EMAIL parameter to CC the document
to the administrator - > attachment="true" subject="Employee
Details for ${ENAME}">
Mr. ${ENAME}, Please review the attached document</xapi:message><! -
Embed the employees name into the email message - >
</xapi:email>
</xapi:delivery>
<xapi:document output-type="pdf" delivery="123"><!Specify the
delivery method id to be used - >
<xapi:template type="rtf"
location="\usr\empDet.rtf"></xapi:template>
</xapi:document>
</xapi:request>
</xapi:requestset>
Should this needs to be added to the data template file (xml file which will attached in the data definition screen) or in the template .rtf file?
Any help on this appreciated.
Thanks
ValliHi,
I need to send a report as an attachment via email using xml publisher. I created data definition, templates and could run a report. I do not know where to add the coding for sending the email? I found the following coding in developer guide:
<?xml version="1.0" encoding="UTF-8"?>
<xapi:requestset xmlns:xapi="http://xmlns.oracle.com/oxp/xapi">
<xapi:request select="/DATA/DEPTS/DEPT/EMPLOYEES/EMPLOYEE"> <! - Burst
on employee element - >
<xapi:delivery>
<xapi:email server="my.smtp.server" port="25"
from=" email@removed " reply-to ="">
<xapi:message id="123" to="${EMAIL}"
<! - Set the id for the delivery method - ><! - Use the employees
EMAIL element to email the document to
the employee - >cc="${ADMIN_EMAIL}"
<! - Use the ADMIN_EMAIL parameter to CC the document
to the administrator - > attachment="true" subject="Employee
Details for ${ENAME}">
Mr. ${ENAME}, Please review the attached document</xapi:message><! -
Embed the employees name into the email message - >
</xapi:email>
</xapi:delivery>
<xapi:document output-type="pdf" delivery="123"><!Specify the
delivery method id to be used - >
<xapi:template type="rtf"
location="\usr\empDet.rtf"></xapi:template>
</xapi:document>
</xapi:request>
</xapi:requestset>
Should this needs to be added to the data template file (xml file which will attached in the data definition screen) or in the template .rtf file?
Any help on this appreciated.
Thanks
Valli -
When I am in craigslist and want to respond to an ad, I click on the email address and it was sending me to outlook express. Then I went into internet options and change the email client to yahoo, and now it send me to yahoo mail ,which is where I want to go. But it is sending me through Internet Explorer, and not Foxfire. What is going on and how do I fix this? I have Foxfire 6.0.
http://support.mozilla.com/en-US/kb/Changing+the+e-mail+program+used+by+Firefox
-
Need to send my spool in HTML format as Email attachment
Hi All,
Can anyone let me know how to send a HTML attachment in a mail.
I have a ALV Report, when i execute, my report should pick the ALV Report output from spool, and should send a mail with spool output as HTML attachment.
Please explain me how i need to do the above.
Regards
NandaHi Nanda,
You can use 2 reports for this.
In one report just display the ALV..
and in the second report submit this first report to memory and get it html format and then send it as an email.
Just check this code (instead of alv...this is a normal report that is sent as HTML attachment)
*--Tables
TABLES: VBRK.
TYPES DECLARATION *
TYPES: BEGIN OF TY_VBRK,
KUNAG TYPE KUNAG," Payer Id
END OF TY_VBRK,
*-- customer details
BEGIN OF TY_KNA1,
KUNNR TYPE KUNNR," Customer Id
NAME1 TYPE NAME1," Customer Name
ADRNR TYPE ADRNR," Address No
END OF TY_KNA1,
*-- Mailing details
BEGIN OF TY_ADDR,
ADDRNUMBER TYPE AD_ADDRNUM, " Address No
MAIL_ID TYPE AD_SMTPADR, " Email Address
END OF TY_ADDR,
*-- Log details
BEGIN OF TY_MSG,
STR1 TYPE AD_SMTPADR, " Email Address
STR2 TYPE KUNNR, " Payer Id
STR3 TYPE NAME1, " Payer Name
STR4 TYPE D, " Date
STR5 TYPE T, " Time
END OF TY_MSG.
I N T E R N A L T A B L E S *
DATA: RECEPIENTS TYPE TABLE OF AD_SMTPADR, "table for email id's
LISTOBJECT TYPE TABLE OF ABAPLIST, "table with displayed list
HTML TYPE TABLE OF W3HTML, "html container
RETURN TYPE TABLE_OF_STRINGS, "message table
IT_VBRK TYPE TABLE OF TY_VBRK, "Billing Details
IT_KNA1 TYPE TABLE OF TY_KNA1, "Customer Details
IT_ADDR TYPE TABLE OF TY_ADDR, "Mail id
IT_MSG TYPE TABLE OF TY_MSG. "Log Details
*-- Structure Declarations
DATA: WA_REC TYPE AD_SMTPADR,
WA_KNA1 TYPE TY_KNA1,
WA_ADDR TYPE TY_ADDR,
WA_MSG TYPE TY_MSG.
Declarations for Sending mail *
*-- To Create link and add recepients address
DATA: SEND_REQUEST TYPE REF TO CL_BCS.
*-- To Create HTML document
DATA: DOCUMENT TYPE REF TO CL_DOCUMENT_BCS.
*-- To Create Sender Id
DATA: SENDER_ID TYPE REF TO IF_SENDER_BCS.
*-- To Create recepient address
DATA: RECIPIENT TYPE REF TO IF_RECIPIENT_BCS.
*-- To Handle Exceptions
DATA: BCS_EXCEPTION TYPE REF TO CX_BCS.
*-- To check if the mail is sent to all recepients
DATA: SENT_TO_ALL TYPE OS_BOOLEAN.
DATA: CONLENGTHS TYPE SO_OBJ_LEN . "To calculate length of the HTML file
V A R I A B L E S *
DATA: REPORT TYPE PROGRAMM, "Report name
SENDER TYPE AD_SMTPADR, "Sender Address
SUBJECT TYPE SO_OBJ_DES. "Subject
DATA: BCS_MESSAGE TYPE STRING ."String to store exceptions
DATA: V_KUNAG TYPE KUNAG. "Payer Id
DATA: V_MAIL TYPE AD_SMTPADR, "Mail Address
V_DATE TYPE ZZBCDATE. "To Validate Entered Date
S E L C T I O N - S C R E E N *
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS: S_ZZBCDA FOR VBRK-ZZBCDAT. "Billing Complete Date
PARAMETERS: P_MAILFT TYPE AD_SMTPADR, "Mail id
P_MAILSC TYPE AD_SMTPADR. "Mail id
SELECTION-SCREEN END OF BLOCK B1.
At Selection Screen *
AT SELECTION-SCREEN.
*-- Validate the dates entered
SELECT ZZBCDAT UP TO 1 ROWS
FROM VBRK
INTO V_DATE
WHERE ZZBCDAT IN S_ZZBCDA.
ENDSELECT.
IF SY-SUBRC <> 0.
MESSAGE E002 WITH 'Dates Not Found In The Given Range'(002).
ENDIF.
S T A R T - O F - S E L E C T I O N *
CONCATENATE SY-UNAME '@YAHOO.COM'(003) INTO SENDER.
*-- Populating the Subject Line
MOVE 'Invoice Due Date Details'(004) TO SUBJECT.
*-- Selecting the Payer Details Based on Input Dates
SELECT KUNAG
FROM VBRK
INTO TABLE IT_VBRK
WHERE ZZBCDAT IN S_ZZBCDA.
*-- Selecting the Address Number from Customer Master
SELECT KUNNR
NAME1
ADRNR
FROM KNA1
INTO TABLE IT_KNA1
FOR ALL ENTRIES IN IT_VBRK
WHERE KUNNR = IT_VBRK-KUNAG.
*-- Selecting the Mail Id's
SELECT ADDRNUMBER
SMTP_ADDR
FROM ADR6
INTO TABLE IT_ADDR
FOR ALL ENTRIES IN IT_KNA1
WHERE ADDRNUMBER = IT_KNA1-ADRNR.
*-- Getting all the selected mail Id's
RECEPIENTS = IT_ADDR[].
MOVE (your first report name) TO REPORT.
IF NOT RECEPIENTS[] IS INITIAL .
LOOP AT IT_KNA1 INTO WA_KNA1.
AT NEW KUNNR.
READ TABLE IT_KNA1 INTO WA_KNA1 WITH KEY KUNNR = WA_KNA1-KUNNR
BINARY SEARCH.
REFRESH RECEPIENTS.
*-- Populating the Recepients Mail Id's for the Particular Kunnr
LOOP AT IT_ADDR INTO WA_ADDR WHERE ADDRNUMBER = WA_KNA1-ADRNR.
IF NOT WA_ADDR IS INITIAL.
TRANSLATE WA_ADDR-MAIL_ID TO UPPER CASE.
APPEND WA_ADDR-MAIL_ID TO RECEPIENTS.
ENDIF.
ENDLOOP.
*-- Appending the mail id's from the input fields when not initial
IF NOT P_MAILFT IS INITIAL.
TRANSLATE P_MAILFT TO UPPER CASE.
APPEND P_MAILFT TO RECEPIENTS.
ENDIF.
IF NOT P_MAILSC IS INITIAL.
TRANSLATE P_MAILSC TO UPPER CASE.
APPEND P_MAILSC TO RECEPIENTS.
ENDIF.
*-- Sending the Kunnr while Submitting the Report
V_KUNAG = WA_KNA1-KUNNR.
TRANSLATE REPORT TO UPPER CASE .
*--Submitting the Report Exporting the List to Memory
SUBMIT (REPORT) WITH S_ZZBCDA IN S_ZZBCDA
WITH P_KUNAG = V_KUNAG
EXPORTING LIST TO MEMORY AND RETURN.
CLEAR: LISTOBJECT , HTML .
REFRESH : LISTOBJECT, HTML .
*-- Calling the Fn Module to get the list from the Memory
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
LISTOBJECT = LISTOBJECT.
*-- Calling Fn Module to get the List in HTML Format
CALL FUNCTION 'WWW_HTML_FROM_LISTOBJECT'
EXPORTING
REPORT_NAME = REPORT
TABLES
HTML = HTML
LISTOBJECT = LISTOBJECT.
*-- Getting the Size of the Html Document
DATA: V_LINES TYPE I.
DESCRIBE TABLE HTML LINES V_LINES.
CLEAR CONLENGTHS .
CONLENGTHS = V_LINES * 255.
TRY.
CLEAR SEND_REQUEST .
SEND_REQUEST = CL_BCS=>CREATE_PERSISTENT( ).
CLEAR DOCUMENT .
*-- Creating the Document
DOCUMENT = CL_DOCUMENT_BCS=>CREATE_DOCUMENT(
I_TYPE = 'HTM'
I_TEXT = HTML
I_LENGTH = CONLENGTHS
I_SUBJECT = SUBJECT ).
*-- add document to send request
CALL METHOD SEND_REQUEST->SET_DOCUMENT( DOCUMENT ).
CLEAR SENDER_ID .
*-- Creating the internet address for the sender id.
SENDER_ID = CL_CAM_ADDRESS_BCS=>CREATE_INTERNET_ADDRESS( SENDER ).
CALL METHOD SEND_REQUEST->SET_SENDER
EXPORTING
I_SENDER = SENDER_ID.
CLEAR WA_REC .
*-- Creating the Recepients address
LOOP AT RECEPIENTS INTO WA_REC .
CLEAR RECIPIENT .
RECIPIENT = CL_CAM_ADDRESS_BCS=>CREATE_INTERNET_ADDRESS(
WA_REC ).
add recipient with its respective attributes to send request
CALL METHOD SEND_REQUEST->ADD_RECIPIENT
EXPORTING
I_RECIPIENT = RECIPIENT
I_EXPRESS = 'X'.
ENDLOOP .
CALL METHOD SEND_REQUEST->SET_STATUS_ATTRIBUTES
EXPORTING
I_REQUESTED_STATUS = 'E'
I_STATUS_MAIL = 'E'.
CALL METHOD SEND_REQUEST->SET_SEND_IMMEDIATELY( 'X' ).
*-- Sending the Document
CALL METHOD SEND_REQUEST->SEND(
EXPORTING
I_WITH_ERROR_SCREEN = 'X'
RECEIVING
RESULT = SENT_TO_ALL ).
IF SENT_TO_ALL = 'X'.
*-- Getting the details to display the Job Log
LOOP AT RECEPIENTS INTO V_MAIL.
WA_MSG-STR1 = V_MAIL.
WA_MSG-STR2 = WA_KNA1-KUNNR.
WA_MSG-STR3 = WA_KNA1-NAME1.
WA_MSG-STR4 = SY-DATUM.
WA_MSG-STR5 = SY-UZEIT.
APPEND WA_MSG TO IT_MSG.
ENDLOOP.
ELSE.
APPEND 'Mail not sent'(005) TO RETURN.
ENDIF.
COMMIT WORK.
CATCH CX_BCS INTO BCS_EXCEPTION.
BCS_MESSAGE = BCS_EXCEPTION->GET_TEXT( ).
APPEND BCS_MESSAGE TO RETURN .
EXIT.
ENDTRY.
ENDAT.
ENDLOOP.
ELSE .
APPEND 'Specify email address for sending'(006) TO RETURN .
ENDIF .
E N D - O F - S E L E C T I O N *
END-OF-SELECTION.
*-- Displaying the Job Log
FORMAT COLOR 1 INTENSIFIED ON.
WRITE:/ SY-ULINE(121),
(40) 'Mail Sent to'(007),
SY-VLINE,
(12) 'Payer Id'(008),
SY-VLINE,
(35) 'Payer Name'(009),
SY-VLINE,
(10) 'Sent Date'(010),
SY-VLINE,
(10) 'Sent Time'(011),
SY-VLINE,
SY-ULINE(121).
LOOP AT IT_MSG INTO WA_MSG.
FORMAT COLOR 2 INTENSIFIED ON.
WRITE:/ SY-ULINE(121),
(40) WA_MSG-STR1,
SY-VLINE,
(12) WA_MSG-STR2,
SY-VLINE,
(35) WA_MSG-STR3,
SY-VLINE,
(10) WA_MSG-STR4 DD/MM/YYYY,
SY-VLINE,
(10) WA_MSG-STR5 USING EDIT MASK '__:__:__',
SY-VLINE,
SY-ULINE(121).
ENDLOOP. -
Sending PO in mail attachment with pdf format
Hello,
We are sending PO to vendor in a pdf attachment. The configuration is in place and as soon as the PO(ME22N) is saved the pdf mail is sent to vendor external mail address.
The requirement however is to add some text to this mail body ( in addition to the existing PDF attachment ).
The NACE config is using SAPFM06P program with entry_neu form and a custom sap script.
can somebody help as where is this mail functionality added in this standard program so that I may try to customize the same for the above requirement.
All I can see is 2 FM used in this ENTRY_NEU Form. Of which I guess ME_PRINT_PO is sending the mail ( I may be wrong here ) but where ?
I will be thankful for any kind of hint to help solve this issue.In general you will have to do the following:
1) Set NAST-NACHA = 8 (Special function)
2) Before OPEN_FORM (maybe in In enhancement spot) if NAST-NACHA = 8, then set itcpo-tdgetotf = 'X' (to get OTF back from CLOSE_FORM!)
3) During CLOSE_FORM, if NAST-NACHA = '8', get OTF output from TABLES parameter OTFDATA
4) Convert this OTF output to PDF using following sample code:
data: I_PDF STRUCTURE TLINE occurs 0,
I_OTF i_otf LIKE itcoo OCCURS 0.
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 134
IMPORTING
bin_filesize = w_bytes
TABLES
otf = i_otf
lines = i_pdf
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
OTHERS = 4.
5) Send email with PDF attachment using the method(s) mentioned in one of these excellent blogs:
/people/thomas.jung3/blog/2004/09/07/sending-e-mail-from-abap--version-46d-and-lower--api-interface
/people/thomas.jung3/blog/2004/09/08/sending-e-mail-from-abap--version-610-and-higher--bcs-interface
or you can follow below procedure as well:
I suggest you make yourself very familiar with the SAP code that does this automatically. Once you understand the processing sequence SAP uses, it is much easier to add your customization and insert your enhancements. To debug it and step through the code, but a breakpoint in ENTRY_NEU, and process a PO. If you're sending your messages using a scheduled job, you'll hit the breakpoint when you process the message using RSNAST00. That's how I did it. I can tell you what I did to meet my requirements. You can change to meet your needs. It required a custom program, to use instead if ENTRY_NEU, and 3 enhancements to SAP code using the Enhancement Framework. You need to know how to use the framework. 1. configure your output type ZNE2 to to run a new program ZMRP_OUTCTRL, to run form routine ENTRY_ZNE2, to create form Z_PURCHASE_ORDER. 2. In ZMRP_OUTCTRL, call standard function modules, ME_READ_PO_FOR_PRINT and ME_PRINT_PO. 3. Drill down into ME_PRINT_PO to PREPARE_FORMULAR function module. Create new enhancement, and if NAST-KSCHL = ZNE2, then lookup the recipient's email address. Pass it as parameter to ADDR_GET_NEXT_COMM_TYPE. 4. Still in ME_PRINT_PO, PREPARE_FORMULAR, add another enhancement to set the value of itcpo-getotf to u2018Xu2019, to enable CLOSE_FORM to capture OTF data for PDF. Only set this OTF flag when the output is being run by RSNAST00, not when a user is simply previewing the printout. Sy-ucomm will be blank when RSNAST00 is running. 5. In ME_PRINT_PO, drill down to ENDE, and add an enhancement to check for NAST-KSCHL = ZNE2, and if so, call standard SAP function modules to END_FORM, START_FORM, WRITE_FORM, and END_FORM. Next call the function CLOSE_FORM, and set table parameter to capture the OTF_DATA as a table parameter OTF_DATA. 6. If OTF_DATA is found, then: If nast-kschl = 'ZNE2'. if NOT otf_data[] is initial. gs_OTF[] = otf_data[]. CALL FUNCTION 'CONVERT_OTF' EXPORTING format = 'PDF' IMPORTING bin_filesize = v_len_in TABLES otf = gs_otf lines = gt_pdf EXCEPTIONS err_max_linewidth = 1 err_format = 2 err_conv_not_possible = 3 OTHERS = 4. IF SY-SUBRC 0. p_retco = '1'. PERFORM protocol_update USING '303' 'OTF Conversion failed.' 'Output Message Cancelled.' space space. IF 1 = 2. MESSAGE S303(me) with 'OTF Conversion failed.'. ENDIF. EXIT. ENDIF. CALL FUNCTION 'QCE1_CONVERT' TABLES T_SOURCE_TAB = gt_pdf T_TARGET_TAB = outbin. IF SY-SUBRC 0. p_retco = '1'. PERFORM protocol_update USING '303' 'PDF Conversion failed.' 'Output Message Cancelled.' space space. IF 1 = 2. MESSAGE S303(me) with 'PDF Conversion failed.'. ENDIF. EXIT. ENDIF. *get email recipients (this is specific to my requirements) select single banfn ernam zuname1 into (lv_banfn, lv_ernam, lv_zuname ) from eban where ebeln = nast-objky. IF SY-SUBRC 0. p_retco = '1'. PERFORM protocol_update USING '303' 'Requisition Data not found.' 'Output Message Cancelled.' space space. IF 1 = 2. MESSAGE S303(me) with 'Requisition Data not found.'. ENDIF. EXIT. ENDIF. 8. Build your OBJPACK and OBJBIN parameters: describe table mail_content lines lin. read table mail_content index lin. mail_data-doc_size = ( lin - 1 ) * 255 + STRLEN( mail_content ). clear objpack-transf_bin. objpack-head_start = 1. objpack-head_num = 0. objpack-body_start = 1. objpack-body_num = lin. objpack-doc_type = 'TXT'. APPEND objpack. describe table outbin lines lin. read table outbin index lin. objpack-doc_size = ( lin - 1 ) * 255 + strlen( outbin ). objpack-transf_bin = 'X'. objpack-head_start = 1. objpack-head_num = 0. objpack-body_start = 1. objpack-body_num = lin. objpack-doc_type = 'PDF'. objpack-obj_name = 'ATTACHMENT'. objpack-obj_descr = l_descr. APPEND objpack. CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1' EXPORTING DOCUMENT_DATA = mail_data PUT_IN_OUTBOX = 'X' TABLES PACKING_LIST = objpack CONTENTS_BIN = outbin CONTENTS_TXT = mail_content RECEIVERS = receivers EXCEPTIONS TOO_MANY_RECEIVERS = 1 DOCUMENT_NOT_SENT = 2 DOCUMENT_TYPE_NOT_EXIST = 3 OPERATION_NO_AUTHORIZATION = 4 PARAMETER_ERROR = 5 X_ERROR = 6 ENQUEUE_ERROR = 7 OTHERS = 8. IF SY-SUBRC 0. p_retco = '1'. PERFORM protocol_update USING '303' 'Send Email function failed.' 'Output Message Cancelled.' space space. IF 1 = 2. MESSAGE S303(me) with 'Send Email function failed.'. ENDIF. EXIT. ENDIF. 9. Call function CLOSE_FORM, and end enhancement
Edited by: Devireddy omkar on Aug 2, 2011 11:15 AM
Edited by: Devireddy omkar on Aug 2, 2011 11:17 AM
Maybe you are looking for
-
Outlook 2011 for Mac Preferences not displaying properly
I have 2 emails set up in my outlook, one of them was a work email for a company I am no longer working for. They have cancelled my email but I am unable to pull up the accounts section of my outlook preferences to remove the account. When I open pre
-
WD MyBook Premium External Drive Giving Problems
This is to transfer files from Mac to PC and generally for backup. I understand 128Gb is a limit for OS X 10.3 I'm using to recognise on a MS-DOS format on this 250Gb disk. I formatted this disk with Disk Utility as a single partition with all the da
-
Can't run Release configuration
Hi everyone, I can run Debug configuration of my application for Mac OS X, but when I try to run Release configuration Xcode writes "The program being debugged i not being run". I checked project settings several times. The file exists. XCode 6.2.4.
-
How to know whether a business package like 'PPS' is installed in a SRM sys
Dear experts, Could you please let me know how to check if a business package like 'PPS' is installed in a SRM system? Is it the correct way to check below way: SPRO -> SRM Server -> Activate Business Function. Thanks and regards, Ranjan
-
Getting an error as "Access denied" while writing the data into CRM 2013?
Hi, I have written code in Script component Transformation to connect CRM 2013. I have used CRM 2013 SDK to connect it. #region Help: Introduction to the Script Component /* The Script Component allows you to perform virtually any operation that can