Sending an excel file in email
Hello all!
I need a help, please someone helps me...
I always send pdf by email without problems, nor i need to send an excel file by email i am using demo mail package, can anyone give an example please???
THank you!
I am sending by the same way of pdf but its showing the message error - ora 21560
CREATE OR REPLACE PROCEDURE P_Envia_Nybot (V_REPORT IN VARCHAR2,V_CAMINHO_REPORT VARCHAR2) IS
p_sender VARCHAR2(100);
p_recipients VARCHAR2(4000);
p_subject VARCHAR2(100) := 'Transaction Confirmation';
p_filename VARCHAR2(5000);
p_blob blob;
V_NOME_ARQUIVO VARCHAR(50);
conn utl_smtp.connection;
i NUMBER;
len NUMBER;
vFlob BFILE;
vBlob BLOB;
v_arquivo2 VARCHAR2(500);
v_report_novo VARCHAR2(200);
BEGIN
UPDATE CIMASTER SET arquivo_NYBOT = (EMPTY_BLOB())
RETURN arquivo_NYBOT INTO vBlob;
VFlob := BFILENAME('ORALOADNYBOT',RTRIM(v_report));
DBMS_LOB.FILEOPEN(vFlob,DBMS_LOB.FILE_READONLY);
DBMS_LOB.LOADFROMFILE(vBlob,vFlob,DBMS_LOB.GETLENGTH(vFlob));
DBMS_LOB.FILECLOSE(vFlob);
SELECT ARQUIVO_NYBOT INTO P_BLOB FROM CIMASTER;
SELECT SENDER INTO P_SENDER FROM CIMASTER_EMAIL;
conn := Demo_Mail.begin_mail(
sender => p_sender,
recipients => '[email protected]',
subject => 'Transaction Confirmations',
mime_type => Demo_Mail.MULTIPART_MIME_TYPE);
Demo_Mail.begin_attachment(
conn => conn,
mime_type => 'TEXT/PLAIN',
inline => TRUE,
filename => v_REPORT,
transfer_enc => 'base64');
-- split the Base64 encoded attachment into multiple lines
i := 1;
len := DBMS_LOB.getLength(p_blob);
WHILE (i < len) LOOP
IF(i + Demo_Mail.MAX_BASE64_LINE_WIDTH < len)THEN
UTL_SMTP.Write_Raw_Data (conn
, UTL_ENCODE.Base64_Encode(
DBMS_LOB.SUBSTR(p_blob, Demo_Mail.MAX_BASE64_LINE_WIDTH, i)));
ELSE
UTL_SMTP.Write_Raw_Data (conn
, UTL_ENCODE.Base64_Encode(
DBMS_LOB.SUBSTR(p_blob, (len - i)+1, i)));
END IF;
UTL_SMTP.Write_Data(conn, UTL_TCP.CRLF);
i := i + Demo_Mail.MAX_BASE64_LINE_WIDTH;
END LOOP;
Demo_Mail.end_attachment(conn => conn);
Demo_Mail.attach_text(
conn => conn,
data => NULL,
mime_type => 'text/html');
Demo_Mail.end_mail( conn => conn );
i := 1;
len := DBMS_LOB.getLength(p_blob);
WHILE (i < len) LOOP
IF(i + Demo_Mail.MAX_BASE64_LINE_WIDTH < len)THEN
UTL_SMTP.Write_Raw_Data (conn
, UTL_ENCODE.Base64_Encode(
DBMS_LOB.SUBSTR(p_blob, Demo_Mail.MAX_BASE64_LINE_WIDTH, i)));
ELSE
UTL_SMTP.Write_Raw_Data (conn
, UTL_ENCODE.Base64_Encode(
DBMS_LOB.SUBSTR(p_blob, (len - i)+1, i)));
END IF;
UTL_SMTP.Write_Data(conn, UTL_TCP.CRLF);
i := i + Demo_Mail.MAX_BASE64_LINE_WIDTH;
END LOOP;
Demo_Mail.end_attachment(conn => conn);
Demo_Mail.attach_text(
conn => conn,
data => NULL,
mime_type => 'text/html');
Demo_Mail.end_mail( conn => conn );
END;
/
Similar Messages
-
Sending an excel file as an attachment to email
Hi,
I am using FM 'SO_DOCUMENT_SEND_API1' to send an excel file to an email ID.But the mail is going to the SAP inbox and it is posting not to the external mail ID like ([email protected]).
Please suggest me on this.
Regards'
Ved.Hi
The mail sending process depends on how your company's mail server has been setup. Check the mail server setup with ur basis/network team. Moreover, go to transaction SCOT and manually trigger the mail sending process.
In this transaction check the SMTP settings if it is set to *ALL.
Moreover, try to manually trigger the send process in SCOT. There is a button called 'Start Send process'. After this check if the mails are still in your SAP Outbox. You can even trigger the send process from within your ABAP program by submitting the program RSCONN* (Try to search with this initials)
Please award points if this was helpful. -
Sending ALV result as Excel file in email and in background mode
Hello,
My need was to developp a generic program to send ALV result in a Excel file by email (as we have already a program to send any spool in PDF format).
I found package SALV_EXPORT which contains very interesting things.
I have done a program with following selection-screen parameters:
- Name of a program to call
- execution variant linked to this program
- several output options (mail, save as local file, save on application server...)
data: g_guid type guid_32.
data : l_xxml_data type xstring.
g_guid = cl_salv_export_db_storage=>create_guid( ).
export l_mode = 'M' to memory id 'ALV_EXTRACT_MODE'.
export l_guid = g_guid to memory id 'ALV_EXTRACT_GUID'.
* call the program with its variant
submit (p_prog)
using selection-set p_vari
and return.
* Get back the data
l_xxml_data = cl_salv_export_db_storage=>import_xmlstring( guid = g_guid ).
Here, we have a XML data (ALVXML or XML for Excel, i don't know) which is the ALV result with the layout applied (either the alv layout specified on selection-screen of called program or default layout).
This solution is so simple that i wonder that it's not documented (or i haven't found the documentation).
If anybody knows any problem with this solution, has anyu remarks or want to add some enhancement, don't hesitate to post..
Hope this help
ChristopheA review of comments in ALV driver code shows references to "Mendocino" which I believe is now called 'Duet". It's part of SAP and Microsoft Office integration suite:
http://www.sap.com/solutions/duet/index.epx
I have used this method of extracting ALV reports in the past but I don't think it's released for general use.
Thanks,
Abdul Rouhi
Washington, DC -
How to send existing excel file through mail
Hello Friends,
I have to send mail with Excel File attachement. i have already exist Excel file and that file i hv to send through mail. so pl help me out for sending existing excel file .
i.e. user pickup the exist excel file and that file would be sent to particular mail id.
thank you,
MarmikHi marmik,
1. There is some trick involved
in the binary files.
2. I have made a program (and it works fantastic)
ONLY 6 LINES FOR EMAILING
BELIEVE ME
ITS A FANTASTIC PROGRAM.
IT WILL WORK LIKE OUTLOOK EXPRESS !
3. The user is provided with
a) file name
b) email address to send mail
and it sends ANY FILE (.xls,.pdf .xyz..)
Instantaneously !
4. Make two things first :
1. Include with the name : ZAMI_INCLFOR_MAIL
2. Report with the name : ZAM_TEMP147 (any name will do)
3. Activate both and execute (2)
4. After providing filename, email adress
5. Code for Include :
10.08.2005 Amit M - Created
Include For Mail (First Req F16)
Modification Log
Data
DATA: docdata LIKE sodocchgi1,
objpack LIKE sopcklsti1 OCCURS 1 WITH HEADER LINE,
objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE,
objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE,
objbin LIKE solisti1 OCCURS 10 WITH HEADER LINE,
objhex LIKE solix OCCURS 10 WITH HEADER LINE,
reclist LIKE somlreci1 OCCURS 1 WITH HEADER LINE.
DATA: tab_lines TYPE i,
doc_size TYPE i,
att_type LIKE soodk-objtp.
DATA: listobject LIKE abaplist OCCURS 1 WITH HEADER LINE.
FORM
FORM ml_customize USING objname objdesc.
Clear Variables
CLEAR docdata.
REFRESH objpack.
CLEAR objpack.
REFRESH objhead.
REFRESH objtxt.
CLEAR objtxt.
REFRESH objbin.
CLEAR objbin.
REFRESH objhex.
CLEAR objhex.
REFRESH reclist.
CLEAR reclist.
REFRESH listobject.
CLEAR listobject.
CLEAR tab_lines.
CLEAR doc_size.
CLEAR att_type.
Set Variables
docdata-obj_name = objname.
docdata-obj_descr = objdesc.
ENDFORM. "ml_customize
FORM
FORM ml_addrecp USING preceiver prec_type.
CLEAR reclist.
reclist-receiver = preceiver.
reclist-rec_type = prec_type.
APPEND reclist.
ENDFORM. "ml_customize
FORM
FORM ml_addtxt USING ptxt.
CLEAR objtxt.
objtxt = ptxt.
APPEND objtxt.
ENDFORM. "ml_customize
FORM
FORM ml_prepare USING bypassmemory whatatt_type whatname.
IF bypassmemory = ''.
Fetch List From Memory
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = listobject
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
MESSAGE ID '61' TYPE 'E' NUMBER '731'
WITH 'LIST_FROM_MEMORY'.
ENDIF.
CALL FUNCTION 'TABLE_COMPRESS'
IMPORTING
COMPRESSED_SIZE =
TABLES
in = listobject
out = objbin
EXCEPTIONS
OTHERS = 1
IF sy-subrc <> 0.
MESSAGE ID '61' TYPE 'E' NUMBER '731'
WITH 'TABLE_COMPRESS'.
ENDIF.
ENDIF.
Header Data
Already Done Thru FM
Main Text
Already Done Thru FM
Packing Info For Text Data
DESCRIBE TABLE objtxt LINES tab_lines.
READ TABLE objtxt INDEX tab_lines.
docdata-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).
CLEAR objpack-transf_bin.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = 'TXT'.
APPEND objpack.
Packing Info Attachment
att_type = whatatt_type..
DESCRIBE TABLE objbin LINES tab_lines.
READ TABLE objbin INDEX tab_lines.
objpack-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objbin ).
objpack-transf_bin = 'X'.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = att_type.
objpack-obj_name = 'ATTACHMENT'.
objpack-obj_descr = whatname.
APPEND objpack.
Receiver List
Already done thru fm
ENDFORM. "ml_prepare
FORM
FORM ml_dosend.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = docdata
put_in_outbox = 'X'
commit_work = 'X' "used from rel. 6.10
IMPORTING
SENT_TO_ALL =
NEW_OBJECT_ID =
TABLES
packing_list = objpack
object_header = objhead
contents_bin = objbin
contents_txt = objtxt
CONTENTS_HEX = objhex
OBJECT_PARA =
object_parb =
receivers = 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.
MESSAGE ID 'SO' TYPE 'S' NUMBER '023'
WITH docdata-obj_name.
ENDIF.
ENDFORM. "ml_customize
FORM
FORM ml_spooltopdf USING whatspoolid.
DATA : pdf LIKE tline OCCURS 0 WITH HEADER LINE.
Call Function
CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = whatspoolid
TABLES
pdf = pdf
EXCEPTIONS
err_no_otf_spooljob = 1
OTHERS = 12.
Convert
PERFORM doconv TABLES pdf objbin.
ENDFORM. "ml_spooltopdf
FORM
FORM doconv TABLES
mypdf STRUCTURE tline
outbin STRUCTURE solisti1.
Data
DATA : pos TYPE i.
DATA : len TYPE i.
Loop And Put Data
LOOP AT mypdf.
pos = 255 - len.
IF pos > 134. "length of pdf_table
pos = 134.
ENDIF.
outbin+len = mypdf(pos).
len = len + pos.
IF len = 255. "length of out (contents_bin)
APPEND outbin.
CLEAR: outbin, len.
IF pos < 134.
outbin = mypdf+pos.
len = 134 - pos.
ENDIF.
ENDIF.
ENDLOOP.
IF len > 0.
APPEND outbin.
ENDIF.
ENDFORM. "doconv
CODE FOR PROGRAM
5.
REPORT zam_temp147 .
INCLUDE zami_inclfor_mail.
DATA
DATA : itab LIKE tline OCCURS 0 WITH HEADER LINE.
DATA : file_name TYPE string.
data : path like PCFILE-PATH.
data : extension(5) type c.
data : name(100) type c.
SELECTION SCREEN
PARAMETERS : receiver TYPE somlreci1-receiver lower case.
PARAMETERS : p_file LIKE rlgrap-filename
OBLIGATORY.
AT SELECTION SCREEN
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CLEAR p_file.
CALL FUNCTION 'F4_FILENAME'
IMPORTING
file_name = p_file.
START-OF-SELECTION
START-OF-SELECTION.
PERFORM ml_customize USING 'Tst' 'Testing'.
PERFORM ml_addrecp USING receiver 'U'.
PERFORM upl.
PERFORM doconv TABLES itab objbin.
PERFORM ml_prepare USING 'X' extension name.
PERFORM ml_dosend.
SUBMIT rsconn01
WITH mode EQ 'INT'
AND RETURN.
FORM
FORM upl.
file_name = p_file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = file_name
filetype = 'BIN'
TABLES
data_tab = itab
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.
path = file_name.
CALL FUNCTION 'PC_SPLIT_COMPLETE_FILENAME'
EXPORTING
complete_filename = path
CHECK_DOS_FORMAT =
IMPORTING
DRIVE =
EXTENSION = extension
NAME = name
NAME_WITH_EXT =
PATH =
EXCEPTIONS
INVALID_DRIVE = 1
INVALID_EXTENSION = 2
INVALID_NAME = 3
INVALID_PATH = 4
OTHERS = 5
ENDFORM. "upl
regards,
amit m. -
Attach an Excel File with Email for External Email Address
Hi,
I want to send an excel file to an external email address as an attachement.
I am using the function module SO_NEW_DOCUMENT_ATT_SEND_API1 for sending the email.
But as far as I know we can only create and send the excel file in this FM. e.g. we can put the text manually and name the file as excel and add it as packing list and send the document.
Now, my client has a template in excel/word which he wants to send as an attachment always when he sends the mail. I have below Queries:
1. Where and how do i store the template which is in Excel or word? He doesnt want to upload the template each time he runs the report. Can I save the file on AL11? how do i insert the file in this?
2. I have tried standard texts, but his template contains a logo. So, I am not sure if that would work. Can I send the template in Binary and just aapend the file extension? xls or doc? would that do?Hi,
See if you can matintain the required templates in document management and use them in your reports.
Try the link below for reference.
[Document Management|http://wiki.sdn.sap.com/wiki/display/PLM/Templates-Document+Management]]
Regards,
Booma -
How to send a csv file by email in SSIS
Hi,
I need to create a SSIS package which creates a csv from sql table and send the same file by email. I have created the package but it thorws error saying the file does not exist in the send email task. For the first time the file will not be present but
the send email task expects the file to be present when executing itself. How to solve this issue?
PreethaIn Execution taks
/*you should map the shared folder to a drive letter*/
EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'My Name',
@recipients = '[email protected]',
@subject = 'Error Log Count',
@file_attachments=N'F:\Testing.txt'
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence -
Why can't I send a pdf file by email?
Why can't I send a pdf file by email?
How are you trying to send it? What happens when you try? What version of Reader?
-
hey guyz iam new to java technology
please tell me whether i ca send a EXCEL file(.xls) extention as a parameter to a method (later i have to create a backup file for that excel sheet) if any one know this method please give me suggestions !!!
posting some code would be helpful
thankyou
bye n cheers
harshalol
If all you want is to create a backup of some file you can do:public class Foo
public static void main(String[] args) {
Foo f = new Foo();
f.createBackup("something.xls");
public void createBackup(String inFile) {
FileInputStream in = null;
FileOutputStream out = null;
try {
in = new FileInputStream(inFile);
out = new FileOutputStream(inFile + ".bak");
int read;
while ((read = in.read()) > -1) {
out.write(read);
out.flush();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (in != null) {
try {
in.close();
} catch (IOException e) {
e.printStackTrace();
if (out != null) {
try {
out.close();
} catch (IOException e) {
e.printStackTrace();
} -
Is it possible to send an excel file through xi
Hi all,
is it possible to send an excel file through xi? if it is possible plz tell me that.....
plz help me on this........
Thanks...Hi,
See this link
integrating legacy system & sap r3 system
Amresh -
Sending an Excel file to Window user?
How can I send an Excel file (xlsx or xls) as an attachment to an e-mail to a recipient who uses Wondows?
Muizen wrote:
my old portable Windows PC doesn't shown Excel as an installed program!
So it can not open the Excel files from my iMac!
Install the free LibreOffice (booted from the PC of course), it will open your Mac's Excel files
How to download and install programs -
Problem in Attachning an Excel File in Email
Hello Everyone,
I have a problem which sends an email containing an excel as an attachment. However, if I check the excel file in the email, the filename is not properly defined, and there is an error stating that the format is not recognizable in excel format.
I am using the function module SO_DOCUMENT_SEND_API1.
Please help.
Thanks,
JimHi,
i am sending some information how to send mails
please check it once,
please reward points, if it is useful.
A SAP mail is a mail internal to the SAP system. It is a very good forum to exchange information with other users. Using a SAP mail in ABAP code facilitates exchange of automatic messages at various stages of the business process. It is easy to use and saves many hassles involved in using workflows for exchanging messages.
The ABAP code to send a sap mail is built around the FM SO_OBJECT_SEND which has the following pattern.
call function 'SO_OBJECT_SEND'
exporting
EXTERN_ADDRESS = ' '
FOLDER_ID = ' '
FORWARDER = ' '
OBJECT_FL_CHANGE = ' '
OBJECT_HD_CHANGE = ' '
OBJECT_ID = ' '
OBJECT_TYPE = ' '
OUTBOX_FLAG = ' '
OWNER = ' '
STORE_FLAG = ' '
DELETE_FLAG = ' '
SENDER = ' '
CHECK_ALREADY_SENT = ' '
importing
object_id_new =
sent_to_all =
tables
OBJCONT =
OBJHEAD =
OBJPARA =
OBJPARB =
receivers =
PACKING_LIST =
ATT_CONT =
ATT_HEAD =
NOTE_TEXT =
exceptions
active_user_not_exist = 1
communication_failure = 2
component_not_available = 3
folder_not_exist = 4
folder_no_authorization = 5
forwarder_not_exist = 6
note_not_exist = 7
object_not_exist = 8
object_not_sent = 9
object_no_authorization = 10
object_type_not_exist = 11
operation_no_authorization = 12
owner_not_exist = 13
parameter_error = 14
substitute_not_active = 15
substitute_not_defined = 16
system_failure = 17
too_much_receivers = 18
user_not_exist = 19
x_error = 20
others = 21.
Import Parameters Name and Description Field name Field function
Object_hd_change (structure)
Contains the process to be done when SAP mail is marked for execution.
When the Execute Icon in the SAP mail is clicked the corresponding object is executed vmtyp D for dialog module
F for function module
R for report
T for transaction
U for transaction with export
Acnam Name of the object which is to be executed, like name of transaction/report
Skips X to execute first screen in background
Objsns Indicates sensitivity of the object.
P for private object
F for functional object
O for confidential object
C for company confidential object
Sensitivity level is restricted to O for documents in shared folders
Objla Language of the document
E for English
sy-langu for system language
Objnam Name of the document
Objdes Short description (Title) of the document
Objsrt Name of the sort field. This is used to group documents based on certain criteria
Object_type
Type of document to be sent with mail RAW for raw text (default)
DOC for word file
XLS for excel file
All classes can be used except for folders (FOL) and distribution lists (DLI)
Outbox_flag X to indicate that mail should also be stored in outbox of the user after sending (default )
Owner Sap login of the user responsible for transmission
Table Parameters Name and Description Field Name Field function
Objcont
Table to hold the body of the mail Line Text lines up to 255 characters
Objhead
Table to hold number of lines in the body of the mail, i.e size of the table in lines Line Text lines up to 255 characters
Objpara
Table to hold the set/get parameters to be transferred to the processing element Name Name of the parameter. Only first three characters are used
Option Not used
Low Value of the parameter in name
High Not used
Objparb
Table to hold information for mails to which a certain processing type is assigned. For a report or transaction with transfer of values to global memory, the table has to contain the parameters with relevant values. The memory id is taken from the first row. For a FM or dialog module, data in table will be transferred as table parameter msgdial Name For report or transaction with transfer of values to global memory, the field for first row should hold the name of the memory id used for export and the other rows should hold the parameter names. For FM or dialog module this field should hold the values as per the usage of the module
Value For report or transaction with transfer of values to global memory, the field for first row should remain empty and the other rows should hold values of the parameters. For FM or dialog module this field should hold the values as per the usage of the module
Receivers
Table to hold recipient details Recnam SAP login of the recipient. Append all the recipients to this table
Sndcp X for sending mail as a copy
Sndex X for sending as express document. This will prompt a logged on recipient saying that he or she has received an express mail
Recesc B for SAP user
E for external email address
U for unix address
Export Parameters Name and Description Field name Field function
Object_id_new
Contains object id of document created during send process
Sent_to_all
X indicates that document was sent to all recipients. Flag is not activated if sending fails in one or more cases
Main Exceptions Name and Description Description
Too_much_receivers Number of recipients is greater than number for which sender is authorised to send
Object_not_sent Document was not delivered to any of the recipients
Object_not_exist Document class specified does not exist or cannot be sent
Object_no_authorisation Document could not be sent as one of the required authorisations does not exist
Parameter_error Invalid combination of parameter values transferred to FM
X_error Internal error occurred
Once all the parameters and table interfaces are properly filled, call the function module to send the SAP mail to the recipient inbox.
Care should be taken to report the status of execution of the function module to the user using one of the exceptions defined (refer function module pattern above)
Though SAP mail is a very robust method of interacting with users within SAP system, it is always good to receive email in Microsoft inbox. This also works like an additional notification to users in case they do not check SAP mail regularly. The next article covers sending E-mails using ABAP.
regards,
satish. -
How to open excel files from email in macro enabled workbooks NOT 2003-2007 worksheets?
I have recently installed Office 365 and it was working great. I needed to open excel documents via email with the macro enabled option. Yesterday it flicked back to only giving me the option to open in 2003-2007 workbook so now I am having issues with the
macros. I am contracting and trying to get work out and this has now caused huge problems.
Am thinking of uninstalling and reinstalling. I did have older versions of ms office so maybe there is some residual content there to remove? I have tried to change the associations and protocols to open in excel macro enabled workbooks but these tick boxes
are greyed out and I do not know how to gain access to these. Have been hunting all through my computer system but do not know how to do this. Am no expert.
If someone could help I would really appreciate it otherwise will need to find some computer shop expert I suppose...urgently ha.
Thanks in advanceit's sound like excel 13 disable the macros, turn on it will fix your issue.
see here:
http://office.microsoft.com/en-us/excel-help/enable-or-disable-macros-in-office-files-HA010354316.aspx
ps: use the local admin to change the setting, the reason why the setting grey out.
KR -
How do I send a pdf file by email
How do I send a PDF file as an attachment to an email?
Just like any other file...
On Sat, Mar 7, 2015 at 12:16 AM, larrys19338374 <[email protected]> -
Issue the send attach Pdf file in Email. (Urgent).
Hello folks, i have issue with attach pdf in e-mail using two lib´s: activation.jar and mail.jar. Currently using a platform SOA and am creating the serviceType, then a file don´t is local and yes by message, so far so good.
Already tried in several forums, but without success.
When send the message (pdf file), the program receive a type ContentType (application/octet-stream) and cause the MessageException, below:
MessageException - in Container:
Message: [B@79ffb7f7 /// the service received the pdf file
[09/03/02 12:22:45] ID=dev_ESBTest (info) application/octet-stream *///ContentType of message*
javax.mail.SendFailedException: Sending failed; *///Exception*
nested exception is:
javax.mail.MessagingException: IOException while sending message;
nested exception is:
**javax.activation.UnsupportedDataTypeException: no object DCH for MIME type application/octet-stream**
at javax.mail.Transport.send0(Transport.java:219)
at javax.mail.Transport.send(Transport.java:81)
javax.mail.MessagingException: IOException while sending message;
nested exception is:
javax.activation.UnsupportedDataTypeException: no object DCH for MIME type application/octet-stream
at com.sun.mail.smtp.SMTPTransport.sendMessage (SMTPTransport.java:353)
at javax.mail.Transport.send0 (Transport.java:164)
at javax.mail.Transport.send(Transport.java:81)
With this, it send the e-mail without attach......above my source simple source code.
ServiceType Code:
protected void SendEmail(XQPart prt, String host, String from, String to) {
// create some properties and get the default Session
Properties props = System.getProperties();
props.put("mail.smtp.host";, host);
Session session = Session.getInstance(props, null);
try {
// create a message
MimeMessage msg = new MimeMessage(session);
msg.setFrom(new InternetAddress(from));
InternetAddress[] address = { new InternetAddress(to) };
msg.setRecipients(Message.RecipientType.TO, address);
msg.setSubject("Test Subject.");
MimeBodyPart bp1 = new MimeBodyPart();
bp1.setText("Test Text.");
MimeBodyPart bp2 = new MimeBodyPart();
m_xqLog.logInformation(prt.getContentType());
bp2.setContent(prt.getContent(), prt.getContentType());
bp2.setFileName("teste.pdf";);
Multipart mp = new MimeMultipart();
mp.addBodyPart(bp1);
mp.addBodyPart(bp2);
msg.setContent(mp);
msg.setSentDate(new Date());
Transport.send(msg);
System.out.println("Email sent successfully!");
} catch (MessagingException mex) {
mex.printStackTrace();
Exception ex = null;
if ((ex = mex.getNextException()) != null) {
ex.printStackTrace();
}Anybody would can help me, please....
Thanks ....
Paulo Sampei.Hello Folks, me again. Then the solution about this question above, below:
Solution:
Code 1: Call 2 method passing requirement parameter:
Obs: Always ContentType = application/octet-stream
ByteArrayInputStream attachStream = new ByteArrayInputStream((byte[]) prt.getContent());
//call constructor class:InputStreamDataSource
InputStreamDataSource isds = new InputStreamDataSource("Testepdf.pdf", prt.getContentType(),attachStream);
//call method sendMail(InputStreamDataSource,host,from,to)
sendMail(isds, s_Host, s_SendFrom, s_SendTo);Code 2: Class InputStreamDataSource
// statement DataSource
private class InputStreamDataSource implements DataSource {
private String name;
private String contentType;
private ByteArrayOutputStream baos;
InputStreamDataSource(String name, String contentType,
InputStream inputStream) throws IOException {
int read;
this.name = name;
this.contentType = contentType;
baos = new ByteArrayOutputStream();
byte[] buff = new byte[256];
while ((read = inputStream.read(buff)) != -1) {
baos.write(buff, 0, read);
public String getContentType() {
// TODO Auto-generated method stub
return contentType;
public InputStream getInputStream() throws IOException {
// TODO Auto-generated method stub
return new ByteArrayInputStream(baos.toByteArray());
public String getName() {
// TODO Auto-generated method stub
return name;
public OutputStream getOutputStream() throws IOException {
// TODO Auto-generated method stub
throw new IOException("Cannot write to this read-only resource");
}Code 3: mehod sendMail(InputStreamDataSource, host, from, to)
protected void sendMail(InputStreamDataSource attach, String host,
String from, String to) {
// create some properties and get the default Session
Properties props = System.getProperties();
props.put("mail.smtp.host", host);
Session session = Session.getInstance(props, null);
try {
// create a message
MimeMessage msg = new MimeMessage(session);
msg.setFrom(new InternetAddress(from));
InternetAddress[] address = { new InternetAddress(to) };
msg.setRecipients(Message.RecipientType.TO, address);
msg.setSubject("Assunto teste.");
// create and fill the first message part
MimeBodyPart bp1 = new MimeBodyPart();
bp1.setText("Texto teste.");
// create the second message part
m_xqLog.logInformation("[ContentType]:[attach] "
+ attach.getContentType());
// attach the file to the message
MimeBodyPart bp2 = new MimeBodyPart();
bp2.setDataHandler(new DataHandler(attach));
bp2.setFileName(attach.getName());
// create the Multipart and add its parts to it
Multipart mp = new MimeMultipart();
mp.addBodyPart(bp1);
mp.addBodyPart(bp2);
// add the Multipart to the message
msg.setContent(mp);
// set the Date: header
msg.setSentDate(new Date());
// send the message
Transport.send(msg);
System.out.println("Email sent successfully!");
} catch (MessagingException mex) {
mex.printStackTrace();
Exception ex = null;
if ((ex = mex.getNextException()) != null) {
ex.printStackTrace();
}Thank you very much, forum and bshannon at your tips.
Cheers,
Paulo Sampei. -
Sending word 2007 file in email
Hi All.
I am trying to send a word 2007 (docx) file in email (via BCS). All other formats like PDF, DOC etc work perfectly fine. But DOCX gives me junk characters.
I have tried to send the attachment in BIN, DOC, DOCX, RAW formats, but all have failed.
Can suggest me what I am doing wrong please?
I am using the ADD_ATTACHMENT method of the CL_DOCUMENT_BCS class.
Thanks in adv.Anybody achieved this guys? Thanks for your time.
Maybe you are looking for
-
Convert PDF (with numerous pages) to image
I would like to convert a 10 page PDF doc to a single image, with the ultimate goal being to embed the image into an excel or word file. thx
-
Internal CA - Cross Forest Enrollment
Hi, I'm trying to get cross-forest certificate enrollment working. My resource forest is built on Serer 2012 R2, and my accounts forest is built on Server 2008 R2. I have s simple setup with an offline Root CA, and an Enterprise subordinate CA. I hav
-
Date displays as M/8/15 in Numbers
just started using Numbers on iPad. Imported a simple excel file, most everything looks OK, but some of the dates in a "Date & Time" formated cell appear in the table like this, "M/8/15" and "M/11/15" rather than 4/8/15 and 4/11/15. When selected a
-
Trouble with Accumulation and percent calculation
I'm fairly new to programming so please be gentle guys because I know this may seem like a stupid question. In this simple polling program I have written, I can not seem to get my number of votes to accumulate nor the percent to calculate and display
-
public static void main(String []args) GraphicsEnvironment myEnvironment = GraphicsEnvironment.getLocalGraphicsEnvironment(); GraphicsDevice myDevice = myEnvironment.getDefaultScreenDevice(); JFrame mainFrame = new JF