Send email attachment inline - OSB
Hello,
I am sending an email with an xml attachment to another system. The target system expects the email attachment to be in 'inline'. Here is my configuration for this.
<con:attachment xmlns:con="http://www.bea.com/wli/sb/context">
<con:Content-Type>text/xml</con:Content-Type>
<con:Content-Transfer-Encoding>7bit</con:Content-Transfer-Encoding>
<con:Content-Disposition>inline; filename=”MyXML”</con:Content-Disposition>
<con:body>{$attachmentXML}</con:body> <!-- dynamically populated -->
<con:body>
My problem is when the email reaches the target, the attachment is not displayed 'inline'. My understanding is with the above configuration 'Content-Disposition' as 'inline', the attachment should be displayed inside 'body' (without the 'paper clipping' image)
Please note: If I use a java class to publish with the above content disposition, the attachment is displayed 'inline'. So I am not worried about the target SMTP server and the target system.
Any help will be appreciated.
With Regards,
Ranjith
Did you select Outbound Request in Transport Header??
Please refer below sample code.
<con2:route xmlns:con2="http://www.bea.com/wli/sb/stages/publish/config">
<con1:id>_ActionId-5670259997675832921-54115704.1426f7f029e.-7c5b</con1:id>
<con2:service ref="ActiveITRoster/BusinessService/BS_MailService" xsi:type="ref:BusinessServiceRef" xmlns:ref="http://www.bea.com/wli/sb/reference"/>
<con2:outboundTransform>
<con4:transport-headers copy-all="false" xmlns:con4="http://www.bea.com/wli/sb/stages/transform/config">
<con1:id>_ActionId-5670259997675832921-54115704.1426f7f029e.-7c5a</con1:id>
<con4:header-set>outbound-request</con4:header-set>
<con4:header name="Content-Type" value="expression">
<con1:xqueryText>'text/html'</con1:xqueryText>
</con4:header>
<con4:header name="Subject" value="expression">
<con1:xqueryText>$emailSubject</con1:xqueryText>
</con4:header>
<con4:header name="To" value="expression">
<con1:xqueryText>$mailids</con1:xqueryText>
</con4:header>
</con4:transport-headers>
</con2:outboundTransform>
</con2:route>
You will find ws, email, http, file, ftp and few other modes of transport when you add a header.
Please select Content-Type in ws & To,Subject (select them depending on your requirement) in email.
Without using transport header, how will you pass the information in the mail?
How will you set the email parameters?
Similar Messages
-
Office 365 json api | send emails with inline attachments
I send the description my team is having with the json integration with Office API 365.
We want to send an email with inline attachments through the JSON API.
With that objective, what we are doing:
1. Create an empty draft message;
2. Send the several inline attachments;
3. Update the body of the draft message (with cid images inline);
4. Send the message;
What is are our issue with the API?
We are unable to set the "ContentType" properties when we submit the attachments to the Office API 365.
Despite the "ContentType" we send, it is always null.
We are using the following API: POST https://outlook.office365.com/api/v1.0/me/messages/{message_id}/attachments
That's the reason we think that despite the inline image then it is found in the body, it cannot be displayed because the contenttype it is not set correctly.
Please give us some direction.
Best Regards,Answered here:
http://stackoverflow.com/questions/27377376/how-do-i-send-email-with-inline-attachments -
Logic Required to send email attachment to particular dealer number ..
I have output data saved in internal table, which has many fields from diff tables.
I need this logic as how to build .... I need to send email attachment to particular dealer number and all his related details ... dealer shldnt get other dealer details ... so i m sorting final output table details by kunnr vbeln and fkdat.
how will i write code or logic which will upload data of particular dealer number in output table one by one and send across as emails ? What i mean is for every customer numbe, his details which can be multiple needs to be send across.
I tried doing this, but didnt get any good results.
sort finaltable by kunnr vbeln fkdat.
loop at Finaltable into workarea.
at new kunnr.
perform mail send function to each customer number
endiat
endloop
Plz advise.
Thnxhi,
you can check this:
FORM docu_send_email USING pv_otfdata TYPE tsfotf
pv_emailid TYPE any
pv_formname TYPE any.
DATA: lv_filesize TYPE i,
lv_buffer TYPE string,
lv_attachment TYPE i,
lv_testo TYPE i.
DATA: li_pdfdata TYPE STANDARD TABLE OF tline,
li_mess_att TYPE STANDARD TABLE OF solisti1,
li_mtab_pdf TYPE STANDARD TABLE OF tline,
li_objpack TYPE STANDARD TABLE OF sopcklsti1,
li_objtxt TYPE STANDARD TABLE OF solisti1,
li_objbin TYPE STANDARD TABLE OF solisti1,
li_reclist TYPE STANDARD TABLE OF somlreci1,
li_objhead TYPE soli_tab.
DATA: lwa_pdfdata TYPE tline,
lwa_objpack TYPE sopcklsti1,
lwa_mess_att TYPE solisti1,
lwa_objtxt TYPE solisti1,
lwa_objbin TYPE solisti1,
lwa_reclist TYPE somlreci1,
lwa_doc_chng TYPE sodocchgi1.
CONSTANTS: lc_u TYPE char1 VALUE 'U',
lc_0 TYPE char1 VALUE '0',
lc_1 TYPE char1 VALUE '1',
lc_pdf TYPE char3 VALUE 'PDF',
lc_raw TYPE char3 VALUE 'RAW',
lc_ordform TYPE char15 VALUE 'ZORDCONFIRM_01',
lc_attachment TYPE char10 VALUE 'ATTACHMENT'.
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = lc_pdf
max_linewidth = 132
IMPORTING
bin_filesize = lv_filesize
TABLES
otf = pv_otfdata
lines = li_pdfdata
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 li_pdfdata INTO lwa_pdfdata.
TRANSLATE lwa_pdfdata USING ' ~'.
CONCATENATE lv_buffer lwa_pdfdata INTO lv_buffer.
CLEAR lwa_pdfdata.
ENDLOOP.
TRANSLATE lv_buffer USING '~ '.
DO.
lwa_mess_att = lv_buffer.
APPEND lwa_mess_att TO li_mess_att.
CLEAR lwa_mess_att.
SHIFT lv_buffer LEFT BY 255 PLACES.
IF lv_buffer IS INITIAL.
EXIT.
ENDIF.
ENDDO.
Object with PDF.
REFRESH li_objbin.
li_objbin[] = li_mess_att[].
DESCRIBE TABLE li_objbin LINES lv_attachment.
Object with main text of the mail.
lwa_objtxt = space.
APPEND lwa_objtxt TO li_objtxt.
CLEAR lwa_objtxt.
DESCRIBE TABLE li_objtxt LINES lv_testo.
Create the document which is to be sent
lwa_doc_chng-obj_name = text-008.
lwa_doc_chng-obj_descr = text-008.
lwa_doc_chng-sensitivty = lc_0.
lwa_doc_chng-obj_prio = lc_1.
lwa_doc_chng-doc_size = lv_testo * 225.
Pack to main body.
CLEAR lwa_objpack-transf_bin.
header
lwa_objpack-head_start = 1.
The document needs no header (head_num = 0)
lwa_objpack-head_num = 0.
body
lwa_objpack-body_start = 1.
lwa_objpack-body_num = lv_testo.
lwa_objpack-doc_type = lc_raw.
APPEND lwa_objpack TO li_objpack.
CLEAR lwa_objpack.
Create the attachment.
Fill the fields of the packing_list for the attachment:
lwa_objpack-transf_bin = gc_x .
header
lwa_objpack-head_start = 1.
lwa_objpack-head_num = 1.
body
lwa_objpack-body_start = 1.
lwa_objpack-body_num = lv_attachment.
lwa_objpack-doc_type = lc_pdf.
lwa_objpack-obj_name = lc_attachment.
lwa_objpack-obj_descr = text-008.
lwa_objpack-doc_size = lv_attachment * 255.
APPEND lwa_objpack TO li_objpack.
CLEAR lwa_objpack.
lwa_reclist-receiver = pv_emailid.
lwa_reclist-rec_type = lc_u.
lwa_reclist-notif_del = gc_x.
lwa_reclist-notif_ndel = gc_x.
APPEND lwa_reclist TO li_reclist.
IF li_reclist IS NOT INITIAL.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = lwa_doc_chng
put_in_outbox = gc_x
TABLES
packing_list = li_objpack
object_header = li_objhead
contents_bin = li_objbin
contents_txt = li_objtxt
receivers = li_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 sy-msgid TYPE 'I' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDIF.
ENDFORM. " DOCU_SEND_EMAIL -
Web jetadmin digital sending - email attachment settings
One of the settings in Web JetAdmin under DIGITAL SENDING is DIGITAL SENDING - EMAIL ATTACHMENT SETTINGS and the options are SMALL, STANDARD and LARGE.
What do these options do? What are small, standard and large? Are they detailed om Mb etc?
ThanksThis seems to be a commercial product. For the best chance at finding a solution I would suggest posting in the forum for HP Business Support!
You can find the Commercial board here:
http://h30499.www3.hp.com/t5/Print-Servers-Network-Storage/bd-p/bsc-254
Best of Luck!
You can say thanks by clicking the Kudos Star in my post. If my post resolves your problem, please mark it as Accepted Solution so others can benefit too. -
Hi All,
I am trying to send a text file as an attachment through an email business service OSB 10gR3. I have followed the below blog for doing this:
http://blogs.oracle.com/christomkins/2009/04/sending_an_email_with_an_attac.html
We are able to send the message but the text attachment is as coming as inline with MIME Boundary when retrieved from the mail server.
hello
--MIME_Boundary
Content-Type: text/plain;
name=hello.txt
Content-Disposition: attachment;
filename=hello.txt
Hello Atheek
MIME_Boundary
where "hello" is the content of the email body and "Hello Atheek" the attachment text.
I could see that the content-type at the root is set to multipart/related by the email transport of OSB, where as when using other smtp clients to send mail with attachments the root content type is set to multipart/mixed. Even setting the content type trannsport header doesn't seem to work. I have followed the blog exactly and created the $attachements/*:attachment as below:
<con:attachment xmlns:con="http://www.bea.com/wli/sb/context">
<con:Content-Type>text/plain</con:Content-Type>
<con:Content-Disposition>attachment;filename="hello.txt"</con:Content-Disposition>
<con:body>Hello Atheek</con:body>
</con:attachment>
Regards,
Atheekproblem is we send out mail to several external clients. we don't have any influence on their mail servers.
we skipped the osb mail transport for the time being and now we use some java webservice implementation -
Send Email Attaching the Report generated in Program.
Hi All,
I am generating a report in list format with write statements.
My requirement is to send an email attaching this report as an attachment.
I wanted to know how to get the listobject of the report generated by my program from the memory. Can anyone guide me with this ?
It will be appreciable , If any one can give me more information on sending mails attaching the reports generated by the program.
Thanks in advance,
MayankHi,
I think the problem is not clear.
My problem is to get the listobject name which got generated after the program run.I want to attach this list report to the email. I have seen a code from one of the link.
Here it is.
List of Users According to Logon Date and Password Change
NOTE: Create ALI/OTF Document in Spool
SUBMIT rsusr200 WITH valid = 'X'
WITH notvalid = space
WITH unlocked = 'X'
WITH locked = space
EXPORTING LIST TO MEMORY AND RETURN.
<b>* Read list from memory into table
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = lt_listobject
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
Error in function module &1
MESSAGE ID '61' TYPE 'E' NUMBER '731'
WITH 'LIST_FROM_MEMORY'.
ENDIF.</b>
Because listobject is of size RAW(1000)
and objbin is of size CHAR(255) we make this table copy
CALL FUNCTION 'TABLE_COMPRESS'
TABLES
in = lt_listobject
out = lt_objbin
EXCEPTIONS
compress_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
Error in function module &1
MESSAGE ID '61' TYPE 'E' NUMBER '731'
WITH 'TABLE_COMPRESS'.
ENDIF.
Here the report is sumitted with the option of exporting the list in to the memory which is later read using 'LIST_FROM_MEMORY'.
But here i need the same report's output to be captured and want to read the list generated from memory into table.
How can i get the listobject of the list generated by the report in the same report program itself ??
Please let me know.
Mayank -
Converting html file into zip file and send email attaching zip file
Hi Experts,
I am trying to send email with attachment(html). Which contains more than 7MB. So, It is throwing an error like Size exceeded.
So, Now i need to compress the data for less than 7MB.
I decided to convert HTML File into ZIP File.
Kindly suggest me to convert the HTML file into ZIP file and sending email with attached ZIP file.
Correct answer rewarded,
Thanks & Regards,
N. HARISH KUMARHi Experts,
*// HTML_TAB converting into ZIP File
DATA : zip_tool TYPE REF TO cl_abap_zip,
filename TYPE string ,
filename_zip TYPE string .
DATA : t_data_tab TYPE TABLE OF x255,
bin_size TYPE i,
buffer_x TYPE xstring,
buffer_zip TYPE xstring.
filename = text-007. "'HTML_TAB
*describe the attachment
DESCRIBE TABLE html_tab LINES tab_lines.
bin_size = tab_lines * 255.
CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
EXPORTING
input_length = bin_size
IMPORTING
buffer = buffer_x
TABLES
binary_tab = html_tab.
IF sy-subrc <> 0.
* message id sy-msgid type sy-msgty number sy-msgno
* with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
*create zip tool
CREATE OBJECT zip_tool.
*add binary file
CALL METHOD zip_tool->add
EXPORTING
name = 'FSSAI_MAIL.HTML'
content = buffer_x.
*get binary ZIP file
CALL METHOD zip_tool->save
RECEIVING
zip = buffer_zip.
CLEAR: t_data_tab[],bin_size.
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = buffer_zip
IMPORTING
output_length = bin_size
TABLES
binary_tab = html_tab.
Thanks & Regards,
N. HARISH KUMAR -
Hi!
I'm new at apex and so far this forum was very helpful. But now I can't find a solution to my problem. So here it goes.
I have a standard report with a checkbox which stores user's id. Now I want to send email to all users who has been checked
with certain data for those users. This is working perfectly. The problem is the attachment file. Client wants that the attachment
file contains data which are meant only for him. For example. I'm sending mail to userA, UserC and userG. The attachment file
for userA must contain data about userA, the attachment file for userc must contain data about userC... The idea is that I make a
report with BI Publisher and use this report as attachment. This is working fine, but in the report query for this template I
don't know how to reference only checked values and how to know in the process of sending email which user is being processed
so I can reference this user in report query. The problem is that the report query is made independently from process of sending email.
Is there a way perhaps making a report query for template dynamically?
Process of sending email looks something like this:
for i in 1..apex_application.g_f01.count
loop
select email into posta from upor where user_st=apex_application.g_f01(i);
datoteka:=apex_util.get_print_document(
p_application_id=>'101',
p_report_query_name=>'priloga',
p_report_layout_name=>'priloga',
p_report_layout_type=>'rtf',
p_document_format=>'rtf');
st_poste:=apex_mail.send(
p_to=>posta,
p_from=>[email protected],
p_body=>mess,
p_subj=>'Subject');
apex_mail.add_attachment(
p_mail_id=>st_poste,
p_attachment=>datoteka,
p_filename=>'priloga.rtf',
p_mime_type=>'application/rtf');
end loop;
If you have a different solution how to solve this, I'm open to ideas.
ThanksWhat I would suggest is doing this in pieces.. You need to build a report based upon certain data elements for a user, correct? get your report working for this case, then look at this article on how to build reports to be saved as blob in your schema : http://www.oracle.com/technology/obe/hol08/apexprnt/apexprnt3_otn.htm.
After that you can look at building a batch job to do the following:
run your reports to build blob columns in a table, along with associated e-mail address
loop through the table and send e-mails from each row's data
thank you,
Tony Miller
Webster, TX -
Flex & PHP - Send email attachment
I'ld like for my visitor to be able to send an email to a friend with the creation from my application as an attatchment (so like a screencap of the creation). I can get Flex and PHP to communicate and send an email, but I can't get the image to send. It sends an attachment that is 2o or less and can't be opened (of course !).
I don't get an error return from my application
I found these posts linked below which helped me, but I still don't get how to pass the image from Flex to PHP.
Saving entire Flash document as JPEG to email as an attachment
Sending an E-mail with attachment with PHP from Flex
Here is my code from Flex :
private function sendMail():void{
var _nomSTF:String = nomSTF.text;
var _emailSTF:String = emailSTF.text;
var _emailFriendSTF:String = emailFriendSTF.text;
var _sujetSTF:String = sujetSTF.text;
var _messageSTF:String = messageSTF.text;
//IMAGE
var fr:FileReference = new FileReference();
var encoder:PNGEncoder = new PNGEncoder();
var screenshotData:BitmapData = new BitmapData(conteneurDeMonImage.width, conteneurDeMonImage.height, true, 0xFFFFFF);
screenshotData.draw(conteneurDeMonImage);
//var outputData:ByteArray = encoder.encode(screenshotData);
//var base64:Base64Encoder = new Base64Encoder();
var png:PNGEncoder = new PNGEncoder();
byteArray = png.encode(screenshotData);
//base64.encodeBytes(outputData);
//FIN IMAGE
var evValidMail:ValidationResultEvent = emailSTFValidator.validate();
var evValidMailFriend:ValidationResultEvent = emailFriendSTFValidator.validate();
var evValidName:ValidationResultEvent = nomSTFValidator.validate();
if (evValidMail.type == ValidationResultEvent.VALID
&& evValidName.type == ValidationResultEvent.VALID
&& evValidMailFriend.type == ValidationResultEvent.VALID){
emailService.send({senderName: _nomSTF, senderEmail:_emailSTF, emailFriendSTF: _emailFriendSTF,
emailSubject:_sujetSTF, emailMessage: _messageSTF, file : byteArray});
} else {
resultLabel.text="There are Form errors";
resultLabel.setStyle("styleName", "invalid");
private function emailResultSTF():void{
Alert.show("Votre message a bien été envoyé");
containerSendToFriend.visible = false;
<fx:Declarations>
<s:HTTPService id="emailService" url="src/mail.php" method="POST"
resultFormat="xml" useProxy="false"
result="emailResultSTF()"
fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail + '\n' + event.message.toString())"/>
</fx:Declarations>
And here's my PHP code :
$fileatt_type = "application/octet-stream";
$fileatt_name = "baignoireElyseeConcept.png";
$sender_name = $_POST['senderName'];
$email_from = $_POST['senderEmail'];
$email_subject = $_POST['emailSubject'];
$email_message = $_POST['emailMessage'];
$email_to = $_POST['emailFriendSTF'];
$headers = 'From:'.$sender_name.'<'.$email_from.'>';
$data= $_POST['file'];
$semi_rand = md5(time());
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
$headers .= "\nMIME-Version: 1.0\n" .
"Content-Type: multipart/mixed;\n" .
" boundary=\"{$mime_boundary}\"";
$email_message = "This is a multi-part message in MIME format.\n\n" .
"--{$mime_boundary}\n" .
"Content-Type:text/html; charset=\"utf-8\"\n" .
"Content-Transfer-Encoding: 7bit\n\n" .
$email_message . "\n\n";
$email_message .= "--{$mime_boundary}\n" .
"Content-Type: {$fileatt_type};\n" .
" name=\"{$fileatt_name}\"\n" .
"Content-Transfer-Encoding: base64\n\n" .
$data . "\n\n" .
"--{$mime_boundary}--\n";
$mailsend = mail($email_to, $email_subject, $email_message, $headers);
Thanks for your helpI've looked around for an answer for this for days and finally got it to work so here's how I did it (helped by a lot of ressources on the internet and specifically this one : http://j-query.blogspot.com/2011/02/save-base64-encoded-canvas-image-to-png.html)
here's my Flex code for my image :
var je:JPEGEncoder = new JPEGEncoder(100);
var bd:BitmapData = new BitmapData(conteneurDeMonImage.width,conteneurDeMonImage.height);
bd.draw(conteneurDeMonImage);
var ba:ByteArray = je.encode(bd);
var be:Base64Encoder = new Base64Encoder();
be.encodeBytes(ba);
var encodedData:String = be.toString();
// Testing if my base64 is working in FLEX
/*var byteArr:ByteArray;
var B64dec:Base64Decoder = new Base64Decoder();
B64dec.decode(encodedData);
byteArr = B64dec.toByteArray();
imageEnGrand.load(byteArr);*/
emailService.send({senderName: _nomSTF, senderEmail:_emailSTF, emailFriendSTF: _emailFriendSTF, emailSubject:_sujetSTF, emailMessage: _messageSTF, file : encodedData});
Here's my PHP code :
$fileatt_type = "application/octet-stream";
$fileatt_name = "test.jpg";
$sender_name = $_POST['senderName'];
$email_from = $_POST['senderEmail'];
$email_subject = $_POST['emailSubject'];
$email_message = $_POST['emailMessage'];
$email_to = $_POST['emailFriendSTF'];
$headers = 'From:'.$sender_name.'<'.$email_from.'>';
$data = $_POST['file'];
$data = str_replace('data:image/png;base64,', '', $data);
$data = str_replace(' ', '+', $data);
$img_data = base64_decode($data);
$png = chunk_split(base64_encode(($img_data)));
$semi_rand = md5(time());
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
$headers .= "\nMIME-Version: 1.0\n"."Content-Type: multipart/mixed;\n"." boundary=\"{$mime_boundary}\"";
$email_message =
"This is a multi-part message in MIME format.\n\n".
"--{$mime_boundary}\n"."Content-Type:text/html; charset=\"utf-8\"\n".
"Content-Transfer-Encoding: 7bit\n\n".$email_message."\n\n";
$email_message .= "--{$mime_boundary}\n" .
"Content-Type: {$fileatt_type};\n" .
" name=\"{$fileatt_name}\"\n" .
"Content-Transfer-Encoding: base64\n\n" .
$png . "\n\n" .
"--{$mime_boundary}--\n";
$mailsend = mail($email_to, $email_subject, $email_message, $headers);
I hope it helps someone who has the same problem as me ! -
Problem in sending Email attachment
Hi all,
I am new to Oracle apex. I want to send email in apex with attchment. i have a send email button on clicking of which the following process will be called
DECLARE
l_id number;
fileName varchar2(50);
v_item blob;
BEGIN
apex_mail.send(
p_to => Receiver email id ,
p_from => Sender email id,
p_subj => 'My Subject',
p_body => 'Test Body',
apex_mail.push_queue();
END;
right now i am able to send email but now dont know how to use -- APEX_MAIL.ADD_ATTACHMENT to send reports as attachments
Here are some queries related to the parameters in APEX_MAIL.ADD_ATTACHMENT:-
1) what to send in parameter ' p_attachment '
2) what to send in parameter ' p_filename'
3)what to send in parameter ' p_mime_type '
my requirement is to send the report displayed in the page to be send as attachment with this email. I am quite confused about these parametersto be sent in APEX_MAIL.ADD_ATTACHMENT.
please provide an example if possible.
Thanks in Advance
Anu
Edited by: user12259335 on Mar 12, 2010 11:55 PM
Edited by: user12259335 on Mar 13, 2010 1:08 AMHi,
You need save your report to CLOB if you like send it using APEX_MAIL.ADD_ATTACHMENT.
You can do that e.g. with xml_spreadsheet
http://matzberger.de/oracle/spreadsheet-tut-en.html
Something like this then
DECLARE
l_cursor NUMBER := dbms_sql.open_cursor;
v_clob CLOB;
l_id NUMBER;
BEGIN
l_id := APEX_MAIL.SEND(
p_to => '[email protected]',
p_from => '[email protected]',
p_subj => 'APEX_MAIL with attachment',
p_body => 'Please review the attachment.',
p_body_html => '<b>Please</b> review the attachment'
dbms_sql.parse(
l_cursor ,
'SELECT * FROM emp',
dbms_sql.native );
xml_spreadsheet.abfrage(
p_cursor => l_cursor ,
p_file => v_clob ,
p_sheetname => 'emp_report'
APEX_MAIL.ADD_ATTACHMENT(
p_mail_id => l_id,
p_attachment => v_clob,
p_filename => 'emp_report.xml',
p_mime_type => 'text/xml'
APEX_MAIL.PUSH_QUEUE;
COMMIT;
END;I did not test that code, but it should work.
This is just one way to do it.
Br,Jari -
Sending emails+attachment from a servlet
Hi all,
I'd like to send emails from within my servlet. There must be a possibility to attach a file that has been uploaded to the server in a previous request.
Currently I'm using sun.net.smtp.SmtpClient to send simple emails.
Does the sun-smtp-package provide a way to attach a file to an email?
regards
SteffenI'm not sure but I think the sun.net.smtp package is part of J2EE. I didn't need to download it. You will need a Base64-Encoding algorithm for transforming the file-data (the attachment) into the email message. OReillys servlet package provides a class for this (www.servlets.com).
Below is an example how to send an email with a file attached to it. You will have to specify the name of an SMTP-Server. If you do not have one you can (for testing purposes) direct the email into a text file.
try{
String host = /** @todo place your smtp-server name or IP here */
SmtpClient smtp = new SmtpClient(host);
smtp.from(from);
smtp.to(toList);
PrintStream out = smtp.startMessage();
Base64Encoder b64e = new Base64Encoder(out); // Base64Encoder is also a Stream which we will only use for the attachment-data
/* uncomment this if there is no smtp-server. The email will be stored in a file
File fEml = new File(/** @todo add your filePath here */+File.separatorChar+"out.eml");
PrintStream out = new PrintStream(new FileOutputStream(fEml));*/
out.println("From: "+from);
out.println("To: "+toList);
out.println("Subject: "+subject);
out.println("Date: "+date.toString());
out.println("MIME-Version: 1.0");
// we have to declare the email multipart/mixed to notify the email client that this mail contains sub parts of different content-types
out.println("Content-Type: multipart/mixed;");
// the boundary-string separates the sub parts (just like in HTTP-Multipart-Requests)
out.println("\tboundary=\"----=_next_part\"");
out.println("\r");
out.println("This is a multipart message in MIME format.");
out.println("\r");
// first sub part starts here - its the text message
out.println("------=_next_part");
// this sub part contains only plain text
out.println("Content-Type: text/plain;");
out.println("\tcharset=\"iso-8859-1\"");
out.println("Content-Transfer-Encoding: 7bit");
out.println("\r");
// Message text goes here
out.println(/** @todo place your message here */);
out.println("\r");
// now the attachment
out.println("------=_next_part");
out.println("Content-Type: application/octet-stream;");
out.println("\tname=\""+fileName+"\"");
out.println("Content-Transfer-Encoding: base64");
out.println("Content-Disposition: attachment;");
out.println("\tfilename=\""+fileName+"\"");
out.println("\n");
// encode file piece by piece
File f = new File(/** @todo place your filepath here */+File.separatorChar+fileName);
FileInputStream fis = new FileInputStream(f);
int i = 0;
do{
byte[] content = {0, 0, 0};
i = fis.read(content, 0, 3);
if (i != -1){
b64e.write(content);
}//if
}while(i != -1);
fis.close();
fis = null;
f = null;
// this is it, all there's left to do is to flush our output-stream and clean up
out.flush();
b64e.close();
out.close();
b64e = null;
smtp.closeServer();
out = null;
smtp = null;
}catch(IOException ioe){
ioe.printStackTrace();
}//catch
HTH
Steffen -
We have an existing Java web application that occasionally needs to send users an email with an image attachment. Right now, the J2EE web app is running on Tomcat in Windows, and we just have it exec() a process that runs the tiny little Blat program, like this:
try {
Process blatProcess = java.lang.Runtime.getRuntime().exec(new String[] {
"C:\\blat222\\full\\blat.exe", "-", "-server", smtpHost,
"-f", copyAddress, "-from", "[email protected]",
"-subject", "ID #" + idNumber,
"-to", this.getRecipientAddress(),
"-bcc", bccAddress,
"-replyto", this.getSenderAddress(), "-attach", attachmentAbsolutePath,
"-body", messageText});
catch (IOException e) {
System.out.println("Problem with running Blat: " + e);
}As you can see, all I need to be able to do is send a little email with an image attachment. I don't even care if I can't BCC our log email address anymore. What would be the quickest/simplest/easiest solution to get the same functionality when we move this web app to Tomcat on Linux? From what I've read, sendmail might be a bigger deal than what I'm looking for. I'd love to be able to do it from within pure Java, but I don't know that I've run across any way to do it without getting into the whole JavaMail API...
Thanks...Woops!!
OK, so it's a J2EE API! Don't fault me for not knowing that.
If you either: program on EE; or are about to and at that point will look into this API, then I pity you. The documentation is pretty terrible.
I won't pretend to have a clue, but the download included a simple looking example called sendFile that seems to do what you want but I wouldn't know how to create a working environment for it (and that might be horrible...).
So sorry! BUT: given the quality of documentation in that API, you might get there faster by just reading the RFC's! -- Stranger things have happened.
In any case;
Good luck!
- Steev. -
I am trying to send an emai from a vbs script. Everything works fine, except for the attachment, as it turns out I can't do:
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = subj
objMessage.To = ToAdd
objMessage.From = FromAddress
objMessage.TextBody = now() & VbCrLf & BodyText
objMessage.AddAttachment = folder & NewFileName & "." & FileExt
Apparently I need to specify an exact location for my file, which isn't ideal as I intend to use the script on different servers, and the filename will change every day. Is there a better way to send an email in vbs as I can't seem to find much information
apart from using CDO.Unfortunately for you, respondents in this forum are unlikely to write the script for you. Here is how you can solve your problem:
Type a search phrase such as "EMail VBscript" into a Google search box. You will get lots of hits.
Play with one or two of the scripts you find until you get the knack of the principle.
Try to customise the script to your specific requirements.
Post your script here and explain which parts you still have a problem with. Do not append your question to someone else's ancient thread. Start a thread of your own!
A new thread was created for this question here:
https://social.technet.microsoft.com/Forums/scriptcenter/en-US/c07ce69b-1ace-4e08-acdd-a29b503de7c0/vbscript-novice-needs-help?forum=ITCG
Don't retire TechNet! -
(Don't give up yet - 13,225+ strong and growing) -
Send Email Attachment From Workflow
Hi Experts,
I am working on the requirement of a Workflow. A mail has to be triggered to the customer with attachments. These attachments should be attached on the fly by the User, i.e, the User should be prompted to attach docs to the mail from WF before it is sent to customer. How can I acheieve this functionality?
Regards,
PrasadHai Shiva Prasad
Iam Sending a sample Code
Check this
REPORT ZRICH_0003.
DATA: ITCPO LIKE ITCPO,
TAB_LINES LIKE SY-TABIX.
Variables for EMAIL functionality
DATA: MAILDATA LIKE SODOCCHGI1.
DATA: MAILPACK LIKE SOPCKLSTI1 OCCURS 2 WITH HEADER LINE.
DATA: MAILHEAD LIKE SOLISTI1 OCCURS 1 WITH HEADER LINE.
DATA: MAILBIN LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
DATA: MAILTXT LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
DATA: MAILREC LIKE SOMLREC90 OCCURS 0 WITH HEADER LINE.
DATA: SOLISTI1 LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE.
PERFORM SEND_FORM_VIA_EMAIL.
FORM SEND_FORM_VIA_EMAIL *
FORM SEND_FORM_VIA_EMAIL.
CLEAR: MAILDATA, MAILTXT, MAILBIN, MAILPACK, MAILHEAD, MAILREC.
REFRESH: MAILTXT, MAILBIN, MAILPACK, MAILHEAD, MAILREC.
Creation of the document to be sent File Name
MAILDATA-OBJ_NAME = 'TEST'.
Mail Subject
MAILDATA-OBJ_DESCR = 'Subject'.
Mail Contents
MAILTXT-LINE = 'Here is your file'.
APPEND MAILTXT.
Prepare Packing List
PERFORM PREPARE_PACKING_LIST.
Set recipient - email address here!!!
MAILREC-RECEIVER = '[email protected]'.
MAILREC-REC_TYPE = 'U'.
APPEND MAILREC.
Sending the document
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = MAILDATA
PUT_IN_OUTBOX = ' '
TABLES
PACKING_LIST = MAILPACK
OBJECT_HEADER = MAILHEAD
CONTENTS_BIN = MAILBIN
CONTENTS_TXT = MAILTXT
RECEIVERS = MAILREC
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
OPERATION_NO_AUTHORIZATION = 4
OTHERS = 99.
ENDFORM.
Form PREPARE_PACKING_LIST
FORM PREPARE_PACKING_LIST.
CLEAR: MAILPACK, MAILBIN, MAILHEAD.
REFRESH: MAILPACK, MAILBIN, MAILHEAD.
DESCRIBE TABLE MAILTXT LINES TAB_LINES.
READ TABLE MAILTXT INDEX TAB_LINES.
MAILDATA-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( MAILTXT ).
Creation of the entry for the compressed document
CLEAR MAILPACK-TRANSF_BIN.
MAILPACK-HEAD_START = 1.
MAILPACK-HEAD_NUM = 0.
MAILPACK-BODY_START = 1.
MAILPACK-BODY_NUM = TAB_LINES.
MAILPACK-DOC_TYPE = 'RAW'.
APPEND MAILPACK.
Creation of the document attachment
This form gets the OTF code from the SAPscript form.
If you already have your OTF code, I believe that you may
be able to skip this form. just do the following code, looping thru
your SOLISTI1 and updating MAILBIN.
PERFORM GET_OTF_CODE.
LOOP AT SOLISTI1.
MOVE-CORRESPONDING SOLISTI1 TO MAILBIN.
APPEND MAILBIN.
ENDLOOP.
DESCRIBE TABLE MAILBIN LINES TAB_LINES.
MAILHEAD = 'TEST.OTF'.
APPEND MAILHEAD.
Creation of the entry for the compressed attachment
MAILPACK-TRANSF_BIN = 'X'.
MAILPACK-HEAD_START = 1.
MAILPACK-HEAD_NUM = 1.
MAILPACK-BODY_START = 1.
MAILPACK-BODY_NUM = TAB_LINES.
MAILPACK-DOC_TYPE = 'OTF'.
MAILPACK-OBJ_NAME = 'TEST'.
MAILPACK-OBJ_DESCR = 'Subject'.
MAILPACK-DOC_SIZE = TAB_LINES * 255.
APPEND MAILPACK.
ENDFORM.
Form GET_OTF_CODE
FORM GET_OTF_CODE.
DATA: BEGIN OF OTF OCCURS 0.
INCLUDE STRUCTURE ITCOO .
DATA: END OF OTF.
DATA: ITCPO LIKE ITCPO.
DATA: ITCPP LIKE ITCPP.
CLEAR ITCPO.
ITCPO-TDGETOTF = 'X'.
Start writing OTF code
CALL FUNCTION 'OPEN_FORM'
EXPORTING
FORM = 'ZTEST_FORM'
LANGUAGE = SY-LANGU
OPTIONS = ITCPO
DIALOG = ' '
EXCEPTIONS
OTHERS = 1.
CALL FUNCTION 'START_FORM'
EXCEPTIONS
ERROR_MESSAGE = 01
OTHERS = 02.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
WINDOW = 'MAIN'
EXCEPTIONS
ERROR_MESSAGE = 01
OTHERS = 02.
Close up Form and get OTF code
CALL FUNCTION 'END_FORM'
EXCEPTIONS
ERROR_MESSAGE = 01
OTHERS = 02.
MOVE-CORRESPONDING ITCPO TO ITCPP.
CALL FUNCTION 'CLOSE_FORM'
IMPORTING
RESULT = ITCPP
TABLES
OTFDATA = OTF
EXCEPTIONS
OTHERS = 1.
Move OTF code to structure SOLI form email
CLEAR SOLISTI1. REFRESH SOLISTI1.
LOOP AT OTF.
SOLISTI1-LINE = OTF.
APPEND SOLISTI1.
ENDLOOP.
ENDFORM.
Thanks & regards
Sreenivasulu P -
Sending email attachment to new email
I am not exactly good with computers and am having difficulty transfering a document onto an email as an attachment. Can you help me please. Wendy
I have scanned from original documents and have moved the images to docs. I have then moved the doc
ID to your menu and changed to PDF and added email address. I have then selected 'send file' but it does not give me the option of adding it as an attachment to an email so I can explain the reason for sending them a copy of the image. Do you have a step by step way of explaining what I should be doing. At the moment I am just guessing.
Maybe you are looking for
-
Open Dataset fails with "Invalid Argument"
From an ABAP program I can't write to a share folder on a windows 2000 box. The share permissions are set to Everyone Full control. I can write to a share on a windows 2003 box, but not windows 2000. Here is my code: data: filename type string. da
-
Input for CD Linear Simulation.vi in a Simulation Loop
Hi I'm new to LabView and I was trying to implement a real time estimator for a linear system, so a steady state gain is acceptable (estimator doesn't need to be adaptive). It will be implemented in real time target (cDAQ). The estimator will get the
-
Hi, I've been trying to connect to a MySQL database from Java. I have no problems from PHP so the db is fine, but suspect this is a driver issue. I was using the Netbeans IDE but have now switched to a basic texteditor and command line to try underst
-
How do I get rid of a contact list that is on my FaceTime screen?
How do I get rid of a contact list that is on my FaceTime screen?
-
Could you tell me what i'm doing wrong with this code? I posted earlier for inputting char into a variable, but the post just got too long. I've tried below with code, but I can't get it right. Can you help me..? import java.io.*; public class Goals