File as attachment in email form
hi all,
It would be a great help for me if any one can help me, how
to send a file( minimum of 300k ) as attachment through a email
form created in flex....
please help me ...
thanks
hi all i have got a php code which sends attachments via
mail..... Please help me how to send the file parameters to the php
via http service send method.... i am placing the php and flex
codes here please help Sad
PHP code
<?php
$to = '[email protected]';
$from = $_POST[email];
$name = $_POST["name"];
$subject = $_POST["title"];
$emailMessage = $_POST["message"];
$message = "\nFrom: $name\nEmail Address:
$frommail\nContact Number: $phone\n\n $emailMessage";
$message = StripSlashes($message);
$fileatt = $_FILES['fileatt']['tmp_name'];
$fileatt_type = $_FILES['fileatt']['type'];
$fileatt_name = $_FILES['fileatt']['name'];
$headers = "From: $frommail";
if (is_uploaded_file($fileatt)) {
$file = fopen($fileatt,'rb');
$data = fread($file,filesize($fileatt));
fclose($file);
$semi_rand = md5(time());
$mime_boundary =
"==Multipart_Boundary_x{$semi_rand}x";
$headers .= "MIME-Version: 1.0\n" .
"Content-Type: multipart/mixed;\n" .
"
boundary=\"{$mime_boundary}\"";
$message = "This is a multi-part message in MIME
format.\n\n" .
"--{$mime_boundary}\n" .
"Content-Type: text/html;
charset=\"iso-8859-1\"\n" .
"Content-Transfer-Encoding: 7bit\n\n" .
$message . "\n\n";
$data = chunk_split(base64_encode($data));
$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";
}else echo "File error! ";
mail($to, $subject, $message,$headers);
?>
Flex code...
<?xml version="1.0"
encoding="utf-8"?>
<mx:Application xmlns:mx="
http://www.adobe.com/2006/mxml"
viewSourceURL="srcview/index.html"
creationComplete="init();">
<mx:HTTPService id="httpService"
url="
http://jibysubhash.x10hosting.com/jibysk/sendmail.php"
method="POST">
<mx:request >
<name>{txtname.text}</name>
<email>{txtemail.text}</email>
<phone>{txtphmo.text}</phone>
<title>{txtpost.text}</title>
<message>{txtcover.text}</message>
</mx:request>
</mx:HTTPService>
<mx:Script>
<![CDATA[
private var file:FileReference = new FileReference();
private function init():void
file.addEventListener(Event.SELECT, selectHandler);
private function selectHandler(event:Event):void
private function browse(event:MouseEvent):void
var filefilter:FileFilter = new FileFilter("Resume
Files",
"*.zip;*.doc;*.pdf;*.txt;*.rar;*.docx");
file.browse([filefilter]);
]]>
</mx:Script>
<mx:Panel id="panel1"
width="691" height="665"
layout="absolute" title="Apply for the
job" >
<mx:Form x="0"
y="0">
<mx:FormItem fontWeight="bold"
color="#000000" id="nam"
label="Name : ">
<mx:TextInput width="354"
height="20" id="txtname"
/>
</mx:FormItem>
<mx:FormItem fontWeight="bold"
color="#000000" id="mail"
label="Email : ">
<mx:TextInput width="354"
height="20" id="txtemail"
/>
</mx:FormItem>
<mx:FormItem fontWeight="bold"
color="#000000" id="phone"
label="Phone/mobile : ">
<mx:TextInput width="354"
height="20"
id="txtphmo"/>
</mx:FormItem>
<mx:FormItem fontWeight="bold"
color="#000000" id="post"
label="Post applied : ">
<mx:TextInput width="477"
height="20" enabled="false"
editable="false" id="txtpost"
text="test mail"/>
</mx:FormItem>
<mx:FormItem fontWeight="bold"
color="#000000" id="upload"
label="Upload resume : ">
<mx:Button label="Browse"
id="bro"
click="browse(event);"/>
</mx:FormItem>
<mx:FormItem fontWeight="bold"
color="#000000" id="cover"
label="Cover Letter : ">
<mx:TextArea width="507"
height="350"
id="txtcover"/>
</mx:FormItem>
<mx:FormItem label=" " >
<mx:Button label="Send"
id="applynow"
click="httpService.send();" />
</mx:FormItem>
</mx:Form>
<mx:Label x="210"
y="125" text=" "
maxWidth="300"
id="statuss"/>
</mx:Panel>
</mx:Application>
Similar Messages
-
How to send txt file as attachement in email
Hi Experts ,
How to send txt file as attachement in email .
which function module i useHi,
Try to use this one
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
Hope it can solve your problem!
Good luck!
Tao -
In Adobe froms - Sending PDF file as Attachment via email
I have to develop a <b>PDF form</b> and one more requirement; I have to change the mail Content (body) and the Subject line which should have attached PDF file.The (Transaction Code VA21) Has the sending the Email part. My Requirement is to <b>Change the Content (body) and the Subject</b>.
Requirement;
When customer request for the quote, quote document is created in SAP (Transaction Code VA21). Promised Price, quantity, date is communicated to customer via quote output. Customer may decide to place firm order with reference to quote.
So this form (PDF file and send via email) is used to communicate the AMAT quote to customer. The PDF file will be as a attachment in the mail. With change subject line, and content of the mail (Thanks for the Quote, Please dont reply to this mail). It also consists of applicable terms & condition of the quote.
Is it possible to handle the Content and the Subject of the mail in Program or Form layout (SFP). or it's Enhancement?
How to go about it? I tried a lot. At last am contacting you. Please.............. Let me know. Very urgent.Point will be given sooon. Tnx a lot.....
#SinivasHi,
Yes But you can use ADOBE FORMS for that... Check this link for presentation...
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/c0c139d3-3eae-2910-01a1-d253f2587b0e?prtmode=navigate
Check this BLOG for sending Email through ABAP..
Sending E-Mail from ABAP - Version 610 and Higher - BCS Interface
One more thing... You can download your data to a PDF file and send that PDF file via program...
Search this Forum for more answers.. you would get plenty out of it...
Check this thread for further information..
Sending mail with 2 attachments
Hope this would help you.
Any queries plz revert back
Good luck
Narin -
How to send zip file as attachment through email
Hi All,
I am having a requirement that I need to download the internal table data into .txt file and I need to zip the text file. And this zip files needs to send to the customer through email.
I am able download the data into .txt and able to zip the file. But I am not able send the .zip file through email.
I know that we can send .xls, .txt, .csv and also .ppt, .doc file types we can send as an attachement through abap program. But I don't know about .zip files. Is there any possibilty to send .zip file as an attachment thorugh email.
Can any one help me how to send a .zip file thorugh email as an attachment.
Regards,
vinodhi Vinod,
Can you please tell me how you have zipped the file.
I am having a text file in application server. I need to zip that file. Then the middleware moves it to Legacy system.
I used the following code. With this I am having the data in Binary format which my midleware cannot understand.
What I need on the whole is just to reduce the size of the file.
form ZIP_FILE .
DATA: lt_data TYPE TABLE OF x255,
lt_textdata TYPE TABLE OF x255.
DATA: ls_data LIKE LINE OF lt_data.
DATA: lv_dsn1(100) VALUE '/ECD/120/GIS/FTP/IB/DNBPAYDEX.TXT'.
DATA: lv_dsn3(100) VALUE '/ECD/120/GIS/FTP/IB/DNBPAYDEXZIP.zip'.
*DATA: lv_dsn3(100) VALUE '/interfaces/SM5/test.zip'. " Contains sample1.xls and sample2.xls
DATA: lv_file_length TYPE i.
DATA: lv_content TYPE xstring.
DATA: lo_zip TYPE REF TO cl_abap_zip.
CREATE OBJECT lo_zip.
Read the data as a string
clear lv_content .
OPEN DATASET lv_dsn1 FOR INPUT IN BINARY MODE.
READ DATASET lv_dsn1 INTO lv_content .
CLOSE DATASET lv_dsn1.
lo_zip->add( name = 'sample.TXT' content = lv_content ).
lv_content = lo_zip->save( ).
*clear lv_content .
Conver the xstring content to binary
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = lv_content
IMPORTING
output_length = lv_file_length
TABLES
binary_tab = lt_data.
OPEN DATASET lv_dsn3 FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
LOOP AT lt_textdata INTO ls_data.
TRANSFER ls_data TO lv_dsn3.
ENDLOOP.
CLOSE DATASET lv_dsn3.
IF sy-subrc EQ '0'.
MESSAGE s999(zfi_ap_gl) WITH text-t10.
ENDIF.
Can you please help.
Thanks Aravind -
How to send file as attachment in Email in Oracle UCM
Hi All,
I have created a simple html form which executes my custom service( internally calls java method) to send a email "forms data" to the user. I need to send file as attchment in email so how i can do it in oracle ucm.Currently i am using intradoc api.I am using a jquery plugin for sending forms data including uploaded file.
function which i am using in java for sending emails:-
InternetFunctions.sendMailTo(emailStr, "MyMail", subject, this.m_service);
I have set method="post" and enctype="multipart/form-data" in the form
So plz help to provide a solution to send a file as attchment in email
Thanks,
user9018217From what I remember, there isn't an "out of the box" solution since InternetFunctions only provides some basic email functions (try decompiling the class to see what's available).
Here's the link for the original Stellent 10gR3 sample components: http://www.oracle.com/technetwork/middleware/content-management/index-092832.html. Take a look at the AcmeMail component within the HowTo Components sample. It shows how to create a custom idcservice that sends basic emails. You can use that as a baseline for creating your own email service and then use something like JavaMail to implement attachments. That's what I did.
Good luck, and please award points as necessary. -
FCPro to Quicktime file - Error attaching to Email
I exported a FCPro sequence to Quicktime. Now I'm trying to email that Quicktime file to someone, but I'm getting an error message -"that it cannot be added until all files already attached are finished uploading" - yet I can watch the sequence on Quicktime. I need any advice as I have to get this project out. Thanks!
sounds like you are using a webmamil interface which only allows you to upload one file at a time. Which means the message probably means exactly what it says - another attachment on that message has not finished uploading.
If an upload has stalled, try creating a new message. There is probably nothing about your QT file that would cause this issue.
Hope this helps -
Max Average -
Trying to make a php file work with my email form
Hello,
Going slightly mad trying to link my php file with my html and actually getting it to work.
It (the php file) keeps coming up with a syntax error on line 37 - code hinting may not work etc etc but there is no error from what I can see - can anyone else point out the obviously to me? This is driving me around the bend!
my code:
<?php
/*Subject and Email Variables */
$emailSubject = 'Website Form';
$webMaster = '[email protected]';
/* Gathering Data Variables */
$nameField = $_POST['name'];
$addressField = $_POST['address'];
$telephone1Field = $_POST['telephone1'];
$telephone2Field = $_POST['telephone2'];
$emailField = $_POST['email'];
$name2Field = $_POST['name2'];
$ageField = $_POST['age'];
$dobField = $_POST['dob'];
$commsField = $_POST['comms'];
$messageField = $_POST['message'];
$body = <<<EOD
<br><hr><br>
Name: $name <br>
Address: $address <br>
Telephone (daytime): $telephone1 <br>
Telephone (mobile): $telephone2 <br>
Email: $email <br>
Childs Name: $name2 <br>
Start Age: $age <br>
Childs Date of Birth: $dob <br>
Preferred form of communication: $comms <br>
Message: $message <br>
EOD;
$headers = "From: $email\r\n";
$headers .= "Content-type: text/html\r\n";
$success = mail{$webMaster, $emailSubject,$body, $headers};
/* Results rendered as HTML */
$theResults = <<<EOD
<html>
<head>
<title>Xxx</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
background-color: #f1f1f1;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
font-style: normal;
line-height: normal;
font-weight: normal;
color: #666666;
text-decoration: none;
-->
</style>
</head>
<div>
<div align="left">Thank you for your message, Your email will be answered very soon!</div>
</div>
</body>
</html>
EOD;
echo "$theResults";
?>Line 37 is this:
$success = mail{$webMaster, $emailSubject,$body, $headers};
It should be this:
$success = mail($webMaster, $emailSubject, $body, $headers);
Also the header for the From: is this:$headers = "From: $email\r\n"; but I don't see the variable defined for $email
Also you should know about email injection. Someone could inject your headers and add additional BCC: addresses to send emails to many undisclosed recipients through your mail script. You'd be using your script to turn your server into a host for spam! Sanitize your fields to prevent injection attacks! Security should be the firt priority followed by functionality. If it's unsecure it shouldn't function -
Hi! So out of the blue my Emac has decided that it doesn't want to save files. These are files in any program. When i hit save the program crashes. It also won't let me attach files to emails. When I do that it freezes the web browser and then it crashes. Has anyone else ran into this problem? Any suggestions or ideas?
I did boot up in safe mode and clean out the cache folder and uninstalled the only I have installed recently which was a printer.
Any ideas would be greatly appreciated!!
thanks!
- Jesssmurfguru / Jess,
Welcome to the Apple Discussions!
How much free space is there on the hard drive?
If you open Disk Utility and select the boot volume on the hard drive, what does the SMART status at the bottom of the Disk Utility window say? -
Files not attaching to email or other sites in safari on iMac
When I try to attach a file to email or upload files to different internet sites, Outlook/Safari crashes and a Problem Report notification pops up saying that "Mail quit unexpectedly" or "Safari quit unexpectedly".
This occurs whether I am uploading through the Outlook app, through Hotmail via Safari, or uploading to other sites (for example, when uploading a file to seek.com).
This is very frustrating as I need to attach files to email for work. i am using an iMac, Mac OS X 10.Please help!What email program are you using or are you using web based email? Perhaps the link text does not contain all the necessary information to identify it.
-
I can't download a file be attached on email...
Today I received some email from JAPAN.
That does include a attach file(filename is 2Byte)..
So I try to download that file at the SAFARI.
But, that filename is cracked.. -_-;;
so.. what can i do..?Why did you try to download with Safari?
If you received an email, can you not open it with your mail program?
Miriam -
Commenting/annotation a 3d file in as an email form
Hi,
Please forgive my ignorance as I have absolutely no experience with Acrobat 3d, it may well be a basic feature that comes out the box etc or it may be I am barking up the wrong tree and someone in here has a better approach.
I have walked into a project that involves the creation and client review of a massive number of 3d assets. I want to be able to create 3d PDFs for each 3d asset that allows our end client to add commenting and mark-up for the revision process that is submitted via email as form type data. Firstly is this possible, and secondly how might this be achieved or can someone suggest a better/alternative approach to this?
Many thanks in advance
JonHi Steve,
We are using both 3ds Max and Maya as our primary content tools, having said that file format in itself doesn't overly concern me as we have a loads of experience in file format conversion/preparation, i.e. I'm confident we can get it working in Acrobat 3d without too many problems. I guess it's more about the capabilities of Acrobat 3d to do this particular design review tasks and the method that it uses, as I said Im completely new to 3d PDF, so forgive the ignorance but Ive been tasked with streamlining our review process.
We have a relational database of assets to which an item is added as per client request this system would track the process from initial asset request through to review and finally to signoff.
I would like to be able use the add commenting and mark-up functionality in 3d PDF to for this review process.
Let me explain the way I would like it to work.
1. We create a 3d PDF file of the asset
2. Provide it to a client on a secure website
3. Client adds markup and comments and submits it via email like a common PDF form component
4. We add the markup and comments to our pdf and asset database.
5. Client signs off and review process is closed.
Is this an out the box type functionality? If not is there much involved in making this work?
Once again thanks for your assistance
Jon -
Acrobat's "Attach to Email" fails due to tooltip behavior???
OK, let me start out by acknowledging that I’m claiming
my car won’t start because the bathroom light is on …
but here goes:
I’ve got a menu of PDF’s with icons next to each
to open, print, email, or select (for multi-print/email) All of the
icons have the tooltip behavior, the only modification being a
slight increase in the offset of the tooltip. The tooltips all work
fine, the icons all work fine, everything opens, prints, or
attaches to emails (via a MAPI behavior I’ve written) as
expected … except … if you open a PDF document and
select “Attach to Email” from Acro Reader’s file
menu, a MAPI email form pops up but hitting send does nothing. Once
a particular instance of the reader has been corrupted it can no
longer email any PDF, even those opened directly by the OS,
however, my own MAPI behavior remains functional and I can still
email PDFs directly from the menu … so the corruption appears
to be in the reader, not the email client.
Before you think I’m crazy, I tried a simple test: 2
buttons, one with just the file open behavior, the other with file
open + tooltip. The file open only behavior works fine all day
long, the file open + tooltip behavior will eventually cause
problems with the reader’s email capability … maybe not
the first time, but after 5 or 6 tries the problem will eventually
surface. Once the problem has surfaced, closing the offending
document but leaving the instance of the reader open will cause all
subsequent attempts to email to fail when opening the PDF from
either button. Closing the reader will restore email if the PDF is
opened from the non-tooltip button and we’re back to where we
started.
We have demonstrated the problem with both Acro Reader 8, and
Acro 7 Pro on XP Pro. Anyone know what might be happening?I added these additional strings via Reg Editor. Similar to a previous posting and it now works fine.
-
Error opening PDF file when send as attachment via email
Hi,
I searched around the forum to resolve my issue and there's alot of post that is related but i can't find any answer to my issues.
Here's the scenario :-
I try to convert the smartform to PDF and then send the PDF as an attachment via email.
After converting the smartform to PDF, i managed to download the file and view it without any problem but i can't view the PDF as an attachment. It has the following error :-
Adobe Reader could not open '4500002325.PDF' because it is either not a supported fle type or because the file has been damaged (for example, it was sent as an email and wasn't correctly decoded
The following is the snapshot of my code:-
* Determine smartform function module for invoice
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = lf_formname
IMPORTING
fm_name = lf_fm_name
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3.
IF sy-subrc <> 0.
* error handling
ent_retco = sy-subrc.
PERFORM protocol_update_i.
ENDIF.
ls_control_param-getotf = 'X'.
CALL FUNCTION lf_fm_name
EXPORTING
archive_index = toa_dara
archive_parameters = arc_params
control_parameters = ls_control_param
mail_recipient = ls_recipient
mail_sender = ls_sender
output_options = ls_composer_param
zxekko = l_doc-xekko " user_settings = ' '
zxpekko = l_doc-xpekko
IMPORTING
document_output_info = l_ssfcrespd
job_output_info = l_ssfcrescl
job_output_options = l_ssfcresop
TABLES
l_xekpo = l_doc-xekpo[]
l_xekpa = l_doc-xekpa[]
l_xpekpo = l_doc-xpekpo[]
l_xeket = l_doc-xeket[]
l_xtkomv = l_doc-xtkomv[]
l_xekkn = l_doc-xekkn[]
l_xekek = l_doc-xekek[]
l_xkomk = l_xkomk
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
IF sy-subrc = 0.
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
FORMAT = 'PDF'
IMPORTING
BIN_FILESIZE = v_len_in
BIN_FILE = v_bin_file
TABLES
OTF = l_ssfcrescl-otfdata
LINES = l_pdf
EXCEPTIONS
ERR_MAX_LINEWIDTH = 1
ERR_FORMAT = 2
ERR_CONV_NOT_POSSIBLE = 3
ERR_BAD_OTF = 4
OTHERS = 5.
* email subject
CONCATENATE 'Purchase order' l_doc-xekko-ebeln INTO lw_subject
SEPARATED BY space.
* RECIPIENTS
lwa_recipients-rec_type = 'U'.
lwa_recipients-express = 'X'.
SELECT adr6~smtp_addr
INTO TABLE gv_smtp_addr
FROM ekko AS ekko INNER JOIN
lfa1 AS lfa1 ON ekko~lifnr = lfa1~lifnr INNER JOIN
adr6 AS adr6 ON adr6~addrnumber = lfa1~adrnr
WHERE ekko~ebeln = l_doc-xekko-ebeln.
IF NOT gv_smtp_addr[] IS INITIAL.
LOOP AT gv_smtp_addr INTO gv_smtp_addr_line FROM 2.
lwa_recipients-receiver = gv_smtp_addr_line.
lwa_recipients-copy = ''.
APPEND lwa_recipients TO ptb_recipients.
ENDLOOP.
* Text Data
CALL FUNCTION 'READ_TEXT'
EXPORTING
id = 'ST'
language = 'E'
name = 'TEST'
object = 'TEXT'
TABLES
lines = lv_lines
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8.
LOOP AT lv_lines INTO lv_lines_line.
ltb_objtxt = lv_lines_line-tdline.
APPEND ltb_objtxt.
ENDLOOP.
DESCRIBE TABLE ltb_objtxt LINES lw_tab_lines.
READ TABLE ltb_objtxt INDEX lw_tab_lines.
* document data contains information for the whole message
lwa_doc_chng-obj_descr = 'ABAPlist'.
* Control Data
lwa_doc_chng-obj_name = 'TESTING'.
lwa_doc_chng-sensitivty = 'F'.
lwa_doc_chng-no_change = 'X'.
lwa_doc_chng-priority = '1'.
lwa_doc_chng-obj_prio = '1'.
lwa_doc_chng-obj_langu = sy-langu.
CLEAR ltb_objpack-transf_bin.
*Attachment
*Move the binary attachment to other internal table.
ltb_objpack-head_start = 1.
ltb_objpack-head_num = 0.
ltb_objpack-body_start = 1.
ltb_objpack-body_num = lw_tab_lines.
ltb_objpack-doc_type = 'RAW'.
APPEND ltb_objpack.
clear : lw_tab_lines.
*Get the number of lines in the Attachment (PDF FILE)
* DESCRIBE TABLE it_mess_att LINES lw_tab_lines.
DESCRIBE TABLE l_objbin lines lw_tab_lines.
ltb_objpack-transf_bin = 'X'.
ltb_objpack-head_start = 1.
ltb_objpack-head_num = 1.
ltb_objpack-body_start = 1.
ltb_objpack-body_num = lw_tab_lines.
ltb_objpack-doc_type = 'PDF'.
ltb_objpack-obj_descr = l_doc-xekko-ebeln.
ltb_objpack-doc_size = lw_tab_lines * 255.
APPEND ltb_objpack.
*Email Subject
lwa_doc_chng-obj_descr = lw_subject.
lwa_recipients-receiver = recipeint.
lwa_recipients-rec_type = 'U'.
lwa_recipients-copy = 'X'.
lwa_recipients-express = 'X'.
APPEND lwa_recipients TO ptb_recipients.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = lwa_doc_chng
COMMIT_WORK = 'X'
TABLES
packing_list = ltb_objpack
contents_bin = l_objbin
contents_txt = ltb_objtxt
receivers = ptb_recipients.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
ENDIF.
Edited by: ~loObie on Apr 23, 2010 12:01 PM
Edited by: ~loObie on Apr 23, 2010 12:02 PMDid you send the pdf in the following format ...
2. Sending PDF as mail.
CLEAR t_receivers.
REFRESH t_receivers.
t_receivers-receiver = sy-uname.
t_receivers-rec_type = 'B'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = 'X'.
t_receivers-notif_ndel = 'X'.
APPEND t_receivers.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = w_doc_data
put_in_outbox = 'X'
sender_address = ld_sender_address
sender_address_type = ld_sender_address_type
commit_work = 'X'
IMPORTING
sent_to_all = w_sent_all
TABLES
packing_list = t_packing_list
contents_bin = t_attachment
contents_txt = it_message
receivers = t_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.
Quote from the Following [LINK|http://www.sap-basis-abap.com/smartforms/convert-the-smart-form-into-pdf-and-send.htm] -
Javascript code for setting output file name of emailed form in Livecycle
I was given a task of creating a new form with livecycle. I have no knowledge of javascripting so I am struggling with one of the things I am trying to get this form to do. The overview of this form is people around my company fill out this form then hit a button to email the completed form to me. I was able to accomplish part of this task by using the following code within an up mouse event script on a button.
oDoc = event.target;
oDoc.mailDoc({
cTo: ********@******.com,
cSubject: "IB Update Request - Instance" + IBInstance.rawValue,
This takes the form and emails it to me with the data from the field called "IBinstance" in the subject line which is what I want but the file name attached to the email is garbage. presently is says "newupdateform.pdf - Adobe Acrobat Pro.pdf"
What I would like is some javascript code that I can take the data from the field called "IBinstance" and use it as the name of the file being sent in. Is there a simple code that i can put in this event to allow me to do this?
Thank youHi Joerg,
I have been trying to solve this as well, but gave up. I also could not get the workaround you found to work with EFM files.
If you do find a solution, please update your message to share?
Thanks
Julie -
Sending PDF file in presentation layer as a attachment to Email
Hi,
I have a PDF file in my Presentation layer, I want to send it as a attachment to Email. Is there any Function Module or sample code to it.
Regards,
Adithya M.Hi Maha,
Go through this hope u can understand. also check this link
http://abapcode.blogspot.com/2007/05/convert-spool-request-to-pdf-and-send.html.
Here is the code to send the Smartform to mail as PDF attachment.
*& Report ZTEST_NREDDY_PDF_MAIL
REPORT ZTEST_NREDDY_PDF_MAIL.
Internal Table declarations
DATA: I_OTF TYPE ITCOO OCCURS 0 WITH HEADER LINE,
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
WA_OBJHEAD TYPE SOLI_TAB,
W_CTRLOP 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
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.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = 'ZTEST'
IMPORTING
FM_NAME = V_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.
W_CTRLOP-GETOTF = 'X'.
W_CTRLOP-NO_DIALOG = 'X'.
W_COMPOP-TDNOPREV = 'X'.
CALL FUNCTION V_FORM_NAME
EXPORTING
CONTROL_PARAMETERS = W_CTRLOP
OUTPUT_OPTIONS = W_COMPOP
USER_SETTINGS = 'X'
IMPORTING
JOB_OUTPUT_INFO = W_RETURN
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.
I_OTF[] = W_RETURN-OTFDATA[].
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
FORMAT = 'PDF'
MAX_LINEWIDTH = 132
IMPORTING
BIN_FILESIZE = V_LEN_IN
TABLES
OTF = I_OTF
LINES = I_TLINE
EXCEPTIONS
ERR_MAX_LINEWIDTH = 1
ERR_FORMAT = 2
ERR_CONV_NOT_POSSIBLE = 3
OTHERS = 4.
IF SY-SUBRC <> 0.
ENDIF.
LOOP AT I_TLINE.
TRANSLATE I_TLINE USING '~'.
CONCATENATE WA_BUFFER I_TLINE 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.
Attachment
REFRESH: I_RECLIST,
I_OBJTXT,
I_OBJBIN,
I_OBJPACK.
CLEAR WA_OBJHEAD.
I_OBJBIN[] = I_RECORD[].
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 = 0.
I_OBJPACK-BODY_START = 1.
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 = 0.
I_OBJPACK-BODY_START = 1.
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 = '[email protected]'.
I_RECLIST-REC_TYPE = 'U'.
APPEND I_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 = 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.
If you want to send some text as Body of the Mail then follow this once
when u r callin the FM'SO_NEW_DOCUMENT_ATT_SEND_API1'.. points to remember
1.u have to pass the body of content in table CONTENTS_TXT(ia m using I_OBJBIN) (each line a record) then. suppose i have appended 11 records to the table CONTENTS_TXT .
2.PACKING_LIST(iam usign I_OBJPACK) table u ahve to append a redord as follows
I_OBJPACK-TRANSF_BIN = ' '.
I_OBJPACK-HEAD_START = 000000000000001.
I_OBJPACK-HEAD_NUM = 000000000000001.
I_OBJPACK-BODY_START = 000000000000002
I_OBJPACK-BODY_NUM = 000000000000010.
I_OBJPACK-DOC_TYPE = 'RAW'.
append I_OBJPACK-.
by the above code system treat the first line in table I_OBJBIN as header and the 2nd line to 10 lines tread as body.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = WA_DOC_CHNG
PUT_IN_OUTBOX = '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.
*& Report ZSPOOLTOPDF *
*& Converts spool request into PDF document and emails it to *
*& recipicant. *
*& Execution *
*& This program can be run in background or online and a spool request *
*& will still be created *
REPORT zspooltopdf.
PARAMETER: p_email1 LIKE somlreci1-receiver
DEFAULT [email protected],
p_sender LIKE somlreci1-receiver
DEFAULT [email protected],
p_delspl AS CHECKBOX,
p_online no-display.
*DATA DECLARATION
DATA: gd_recsize TYPE i.
Spool IDs
TYPES: BEGIN OF t_tbtcp.
INCLUDE STRUCTURE tbtcp.
TYPES: END OF t_tbtcp.
DATA: it_tbtcp TYPE STANDARD TABLE OF t_tbtcp INITIAL SIZE 0,
wa_tbtcp TYPE t_tbtcp.
Job Runtime Parameters
DATA: gd_eventid LIKE tbtcm-eventid,
gd_eventparm LIKE tbtcm-eventparm,
gd_external_program_active LIKE tbtcm-xpgactive,
gd_jobcount LIKE tbtcm-jobcount,
gd_jobname LIKE tbtcm-jobname,
gd_stepcount LIKE tbtcm-stepcount,
gd_error TYPE sy-subrc,
gd_reciever TYPE sy-subrc.
DATA: w_recsize TYPE i,
w_spool_nr like sy-spono.
%_print LIKE pri_params.
DATA: gd_subject LIKE sodocchgi1-obj_descr,
it_mess_bod LIKE solisti1 OCCURS 0 WITH HEADER LINE,
it_mess_att LIKE solisti1 OCCURS 0 WITH HEADER LINE,
gd_sender_type LIKE soextreci1-adr_typ,
gd_attachment_desc TYPE so_obj_nam,
gd_attachment_name TYPE so_obj_des.
Spool to PDF conversions
DATA: gd_spool_nr LIKE tsp01-rqident,
gd_destination LIKE rlgrap-filename,
gd_bytecount LIKE tst01-dsize,
gd_buffer TYPE string.
Binary store for PDF
DATA: BEGIN OF it_pdf_output OCCURS 0.
INCLUDE STRUCTURE tline.
DATA: END OF it_pdf_output.
CONSTANTS: c_dev LIKE sy-sysid VALUE DEV,
c_no(1) TYPE c VALUE ,
c_device(4) TYPE c VALUE LOCL.
*START-OF-SELECTION.
START-OF-SELECTION.
Write statement to represent report output. Spool request is created
if write statement is executed in background. This could also be an
ALV grid which would be converted to PDF without any extra effort
WRITE Hello World.
new-page.
commit work.
new-page print off.
If p_online = X.
Processing performed when program calls itself when run online
gd_spool_nr = sy-spono.
EXPORT gd_spool_nr TO MEMORY ID SPOOLTOPDF.
EXIT.
endif.
IF sy-batch EQ X.
PERFORM get_job_details.
PERFORM obtain_spool_id.
ELSE.
gd_spool_nr = sy-spono.
If executed online, it submits a program to perform the write
statements
instructing it to create a spool request, this could be another
program
which just performs the write statements and then exports sy-spono
to memory. But in this example it calls itself passing X to parameter
p_online, which takes it down an alternative procesing path.
submit ZSPOOLTOPDF
with p_online = X
to sap-spool
spool parameters %_print
archive parameters %_print
without spool dynpro
and return.
ENDIF.
Get spool id from program called above
IMPORT gd_spool_nr FROM MEMORY ID SPOOLTOPDF.
PERFORM convert_spool_to_pdf.
PERFORM process_email.
if p_delspl EQ X.
PERFORM delete_spool.
endif.
IF sy-sysid = c_dev.
wait up to 5 seconds.
SUBMIT rsconn01 WITH mode = INT
WITH output = X
AND RETURN.
ENDIF.
FORM obtain_spool_id *
FORM obtain_spool_id.
CHECK NOT ( gd_jobname IS INITIAL ).
CHECK NOT ( gd_jobcount IS INITIAL ).
SELECT * FROM tbtcp
INTO TABLE it_tbtcp
WHERE jobname = gd_jobname
AND jobcount = gd_jobcount
AND stepcount = gd_stepcount
AND listident 0000000000′
ORDER BY jobname
jobcount
stepcount.
READ TABLE it_tbtcp INTO wa_tbtcp INDEX 1.
IF sy-subrc = 0.
message s004(zdd) with gd_spool_nr.
gd_spool_nr = wa_tbtcp-listident.
MESSAGE s004(zdd) WITH gd_spool_nr.
ELSE.
MESSAGE s005(zdd).
ENDIF.
ENDFORM.
FORM get_job_details *
FORM get_job_details.
Get current job details
CALL FUNCTION GET_JOB_RUNTIME_INFO
IMPORTING
eventid = gd_eventid
eventparm = gd_eventparm
external_program_active = gd_external_program_active
jobcount = gd_jobcount
jobname = gd_jobname
stepcount = gd_stepcount
EXCEPTIONS
no_runtime_info = 1
OTHERS = 2.
ENDFORM.
FORM convert_spool_to_pdf *
FORM convert_spool_to_pdf.
CALL FUNCTION CONVERT_ABAPSPOOLJOB_2_PDF
EXPORTING
src_spoolid = gd_spool_nr
no_dialog = c_no
dst_device = c_device
IMPORTING
pdf_bytecount = gd_bytecount
TABLES
pdf = it_pdf_output
EXCEPTIONS
err_no_abap_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_destdevice = 5
user_cancelled = 6
err_spoolerror = 7
err_temseerror = 8
err_btcjob_open_failed = 9
err_btcjob_submit_failed = 10
err_btcjob_close_failed = 11
OTHERS = 12.
CHECK sy-subrc = 0.
Transfer the 132-long strings to 255-long strings
LOOP AT it_pdf_output.
TRANSLATE it_pdf_output USING ~.
CONCATENATE gd_buffer it_pdf_output INTO gd_buffer.
ENDLOOP.
TRANSLATE gd_buffer USING ~ .
DO.
it_mess_att = gd_buffer.
APPEND it_mess_att.
SHIFT gd_buffer LEFT BY 255 PLACES.
IF gd_buffer IS INITIAL.
EXIT.
ENDIF.
ENDDO.
ENDFORM.
FORM process_email *
FORM process_email.
DESCRIBE TABLE it_mess_att LINES gd_recsize.
CHECK gd_recsize > 0.
PERFORM send_email USING p_email1.
perform send_email using p_email2.
ENDFORM.
FORM send_email *
> p_email *
FORM send_email USING p_email.
CHECK NOT ( p_email IS INITIAL ).
REFRESH it_mess_bod.
Default subject matter
gd_subject = Subject.
gd_attachment_desc = Attachname.
CONCATENATE attach_name INTO gd_attachment_name.
it_mess_bod = Message Body text, line 1′.
APPEND it_mess_bod.
it_mess_bod = Message Body text, line 2 .
APPEND it_mess_bod.
If no sender specified - default blank
IF p_sender EQ space.
gd_sender_type = space.
ELSE.
gd_sender_type = INT.
ENDIF.
Send file by email as .xls speadsheet
PERFORM send_file_as_email_attachment
tables it_mess_bod
it_mess_att
using p_email
Example .xls documnet attachment
PDF
gd_attachment_name
gd_attachment_desc
p_sender
gd_sender_type
changing gd_error
gd_reciever.
ENDFORM.
FORM delete_spool *
FORM delete_spool.
DATA: ld_spool_nr TYPE tsp01_sp0r-rqid_char.
ld_spool_nr = gd_spool_nr.
CHECK p_delspl c_no.
CALL FUNCTION RSPO_R_RDELETE_SPOOLREQ
EXPORTING
spoolid = ld_spool_nr.
ENDFORM.
*& Form SEND_FILE_AS_EMAIL_ATTACHMENT
Send email
FORM send_file_as_email_attachment tables it_message
it_attach
using p_email
p_mtitle
p_format
p_filename
p_attdescription
p_sender_address
p_sender_addres_type
changing p_error
p_reciever.
DATA: ld_error TYPE sy-subrc,
ld_reciever TYPE sy-subrc,
ld_mtitle LIKE sodocchgi1-obj_descr,
ld_email LIKE somlreci1-receiver,
ld_format TYPE so_obj_tp ,
ld_attdescription TYPE so_obj_nam ,
ld_attfilename TYPE so_obj_des ,
ld_sender_address LIKE soextreci1-receiver,
ld_sender_address_type LIKE soextreci1-adr_typ,
ld_receiver LIKE sy-subrc.
data: t_packing_list like sopcklsti1 occurs 0 with header line,
t_contents like solisti1 occurs 0 with header line,
t_receivers like somlreci1 occurs 0 with header line,
t_attachment like solisti1 occurs 0 with header line,
t_object_header like solisti1 occurs 0 with header line,
w_cnt type i,
w_sent_all(1) type c,
w_doc_data like sodocchgi1.
ld_email = p_email.
ld_mtitle = p_mtitle.
ld_format = p_format.
ld_attdescription = p_attdescription.
ld_attfilename = p_filename.
ld_sender_address = p_sender_address.
ld_sender_address_type = p_sender_addres_type.
Fill the document data.
w_doc_data-doc_size = 1.
Populate the subject/generic message attributes
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = SAPRPT.
w_doc_data-obj_descr = ld_mtitle .
w_doc_data-sensitivty = F.
Fill the document data and get size of attachment
CLEAR w_doc_data.
READ TABLE it_attach INDEX w_cnt.
w_doc_data-doc_size =
( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = SAPRPT.
w_doc_data-obj_descr = ld_mtitle.
w_doc_data-sensitivty = F.
CLEAR t_attachment.
REFRESH t_attachment.
t_attachment[] = it_attach[].
Describe the body of the message
CLEAR t_packing_list.
REFRESH t_packing_list.
t_packing_list-transf_bin = space.
t_packing_list-head_start = 1.
t_packing_list-head_num = 0.
t_packing_list-body_start = 1.
DESCRIBE TABLE it_message LINES t_packing_list-body_num.
t_packing_list-doc_type = RAW.
APPEND t_packing_list.
Create attachment notification
t_packing_list-transf_bin = X.
t_packing_list-head_start = 1.
t_packing_list-head_num = 1.
t_packing_list-body_start = 1.
DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
t_packing_list-doc_type = ld_format.
t_packing_list-obj_descr = ld_attdescription.
t_packing_list-obj_name = ld_attfilename.
t_packing_list-doc_size = t_packing_list-body_num * 255.
APPEND t_packing_list.
Add the recipients email address
CLEAR t_receivers.
REFRESH t_receivers.
t_receivers-receiver = ld_email.
t_receivers-rec_type = U.
t_receivers-com_type = INT.
t_receivers-notif_del = X.
t_receivers-notif_ndel = X.
APPEND t_receivers.
CALL FUNCTION SO_DOCUMENT_SEND_API1′
EXPORTING
document_data = w_doc_data
put_in_outbox = X
sender_address = ld_sender_address
sender_address_type = ld_sender_address_type
commit_work = X
IMPORTING
sent_to_all = w_sent_all
TABLES
packing_list = t_packing_list
contents_bin = t_attachment
contents_txt = it_message
receivers = t_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.
Populate zerror return code
ld_error = sy-subrc.
Populate zreceiver return code
LOOP AT t_receivers.
ld_receiver = t_receivers-retrn_code.
ENDLOOP.
ENDFORM.
Reward points if helpful
Thanks
Naveen khan
Maybe you are looking for
-
Problems after amber update in my lumia 520
I have updated my lumia 520. After it there is regular fluctuation in my internet connection even my data setting is on and battery is also discharging quickly after update.
-
While uploading a CSV file i am getting error
Hi All, I am trying to upload a huge CSV file and now it is giving below error: ORA-01653: unable to extend table ADT.SCG_RECIEVABLES2 by 128 in tablespace APEX_1711125608495793205. Any expert,please guide what type of error is it?and what i need to
-
Queue to Journal mailbox filling up
Started yesterday morning but is getting progressively worse. The queue which sends mail to the journal mailbox seems to be processing email, just not fast enough, so the queue continues to get bigger and bigger. No changes were made yesterday. Five
-
Create a clinical document, attaching an external PDF
hi all, is possible to define a clinical document from N2T6 and using it to upload a file into SAP (using KPro) and viewing it from n203 document list?
-
How to create perfect curve in illustrator? I try to make the shapes as perfect as possible, but ultimately it doesn't look perfect....it looks slightly distorted....Please if someone can give me tips to make perfects curves. I'm attaching an image t