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.
Similar Messages
-
When sending email PO in a PDF attachment, the attachment can not be openen
Hi all,
We are trying to send an email with the PO in PDF format. We got the email but the attachment can not be opened.
Error reads: Adobe could not open test.pdf because it is either not a supported file type or because the file has been damaged (for example , it was send as a email attachemnet and was not correctly decoded).
Could any body bring some light? We know that everything in SCOT is fine because we can email the PO through configuration to the vendor without problem. It is just these extra copies that do not work.
a) We are modifying our custom Print program to add the code below after closing the form.
in few words:
a) We are getting the OTF from closing the form.
b) Converting the OTF to PDF
c) Sending the PDF as attachment.
data: lt_docs TYPE TABLE OF docs.
data: pdf_bytecount TYPE i.
data: begin of pdfout occurs 0,
tline type tline,
end of pdfout.
Ende Formulardruck --------------------------------------------------*
CALL FUNCTION 'CLOSE_FORM'
IMPORTING
result = result
tables
otfdata = otf.
IF RESULT-TDSPOOLID NE SPACE.
SPOOLID = RESULT-TDSPOOLID.
PERFORM PROTOCOL_UPDATE USING '320' SPOOLID SPACE SPACE SPACE.
ENDIF.
if result-userexit eq 'C' or
result-userexit eq 'E'.
retco = '9'.
endif.
CALL FUNCTION 'CONVERT_OTF_2_PDF'
IMPORTING
bin_filesize = pdf_bytecount
TABLES
otf = otf
doctab_archive = lt_docs
lines = pdfout
EXCEPTIONS
err_conv_not_possible = 1
err_otf_mc_noendmarker = 2
OTHERS = 3.
Creation of the document to be sent File Name
maildata-obj_name = 'TEST'.
Mail Subject
maildata-obj_descr = 'Subject'.
Mail Contents
append mailtxt.
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.
Move OTF code to structure SOLI form email
CLEAR solisti1. REFRESH solisti1.
LOOP AT otf.
solisti1-line = otf.
APPEND solisti1.
ENDLOOP.
Move pdf code to structure soli form email
clear solisti1. refresh solisti1.
loop at pdfout.
solisti1-line = pdfout.
append solisti1.
endloop.
loop at solisti1.
move-corresponding solisti1 to mailbin.
append mailbin.
endloop.
describe table mailbin lines tab_lines.
mailhead = 'TEST.OTF'.
mailhead = 'TEST.PDF'.
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-doc_type = 'PDF'.
mailpack-obj_name = 'TEST'.
mailpack-obj_descr = 'Subject'.
mailpack-doc_size = tab_lines * 255.
append mailpack.
mailrec-receiver = '[email protected]'.
mailrec-rec_type = 'U'.
append mailrec.
mailrec-receiver = '[email protected]'.
mailrec-rec_type = 'U'.
append mailrec.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = maildata
TABLES
PACKING_LIST = mailpack
OBJECT_HEADER = mailhead
CONTENTS_TXT = mailtxt
RECEIVERS = mailrec
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.
ENDFORM.Dear Monica,
You need to configure the system with respect to functional point of view and need to write the following code in print program. i have done this and solution is as follows.
<b> Reward me for this solution.</b>
Process 11 (MM) Sending RFQs and POs to vendors directly from the system instead of sending thru Courier or Fax
Existing Process (AS-IS) Presently system is not supporting this requirement
Business Requirements RFQs to be linked with vendor master with e-mail to send enquiries directly through system instead of courier/fax. Vice versa P.Os. Specifications, drawings should also go to vendor along with mail.
To-Be
Configuration Settings:
1) Spro Materials management Purchasing Messages Output control Message types Define message types for RFQ/ PO
Created ZEK1,ZMI and ZEK2 for RFQs
Created ZIK,ZOC,ZOK,ZOM,ZSI, ZSK2 and ZSM for Pos
The above New output types Included with existing Print Forms and Programs but modified with External send(5) medium, and added companys letter head thru ABAP developments (details provided below)
The above new output types also maintained for Fine- tuned control (thru same navigation) for New(1) and Change(2) operations
2) Spro Materials management Purchasing Messages Output control Message determination schemas Define message schema for RFQ/ PO
Maintained the new output types in the control data
3) Maintain Condition records for the New out put types (copied same document types from the existing old output types)
Easy access Logistics Materials management Purchasing Master data Messages MN01 (for RFQs)/ MN04 (for Pos)
4) Maintain Email id of Vendor in Vendor master.
Developments (ABAP):
1) Copied the existing print programs and forms of the corresponding out types.
2) Addition of header window in each corresponding form (HEADER window). Uploaded the HEADER3 graphics in the header window.
INCLUDE HEADER3 OBJECT GRAPHICS ID BCOL LANGUAGE EN
3) Added the the following code in TOP includes
TYPE-POOLs szadr.
INCLUDE: LMEDRUCKF09.
data: intnast LIKE snast,
lvs_recipient LIKE swotobjid, "Internet
lvs_sender LIKE swotobjid, "Internet
lvs_comm_type TYPE ad_comm,
lvs_comm_values TYPE szadr_comm_values,
p_retco TYPE i.
5) Addition of the perform to SOS include for header window display
PERFORM WRITE_FORM_HEADER.
*& Form WRITE_FORM_HEADER
text
--> p1 text
<-- p2 text
FORM WRITE_FORM_HEADER.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'HE1'
FUNCTION = 'SET'
TYPE = 'BODY'
WINDOW = 'HEADER'
IMPORTING
PENDING_LINES =
EXCEPTIONS
ELEMENT = 1
FUNCTION = 2
TYPE = 3
UNOPENED = 4
UNSTARTED = 5
WINDOW = 6
BAD_PAGEFORMAT_FOR_PRINT = 7
SPOOL_ERROR = 8
CODEPAGE = 9
OTHERS = 10
ENDFORM.
6) In the corresponding FORM include the following code has been added.
DATA: lvs_comm_type TYPE ad_comm,
lvs_comm_values TYPE szadr_comm_values,
xprogramm type sy-repid.
... use stratagy to get communication type
CALL FUNCTION 'ADDR_GET_NEXT_COMM_TYPE'
EXPORTING
strategy = nast-tcode
address_number = lfa1-adrnr
IMPORTING
comm_type = lvs_comm_type
comm_values = lvs_comm_values
EXCEPTIONS
address_not_exist = 1
person_not_exist = 2
no_comm_type_found = 3
internal_error = 4
parameter_error = 5
OTHERS = 6.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
convert communication data
MOVE-CORRESPONDING nast TO intnast.
MOVE sy-repid TO xprogramm.
7) By using the function module we can get sender and reciepient mail ids to variables lvs_recipient lvs_sender
CALL FUNCTION 'CONVERT_COMM_TYPE_DATA'
EXPORTING
pi_comm_type = lvs_comm_type
pi_comm_values = lvs_comm_values
pi_country = lfa1-land1
pi_repid = xprogramm
pi_snast = intnast
IMPORTING
pe_itcpo = itcpo
pe_device = xdevice
pe_mail_recipient = lvs_recipient
pe_mail_sender = lvs_sender
EXCEPTIONS
comm_type_not_supported = 1
recipient_creation_failed = 2
sender_creation_failed = 3
OTHERS = 4.
IF sy-subrc <> 0.
Avoids cancellation with message TD421
p_retco = '1'. "831984
PERFORM protocol_update USING '740' space space space space.
dummy message to make the message appear in the where-used list
IF 1 = 2.
MESSAGE S740(me).
ENDIF.
EXIT.
ENDIF.
IF xdevice = 'MAIL'. "885787
Check validity of email address to avoid cancellation with TD463
CALL FUNCTION 'SX_ADDRESS_TO_DEVTYPE' "831984
EXPORTING
recipient_id = lvs_recipient
sender_id = lvs_sender
EXCEPTIONS
err_invalid_route = 1
err_system = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
p_retco = '1'.
PERFORM protocol_update USING '740' space space space space.
dummy message to make the message appear in the where-used list
IF 1 = 2.
MESSAGE S740(me).
ENDIF.
EXIT.
ENDIF.
ENDIF.
8) Attaching the new print program and form in NACE transaction.
Steps for End user:
1) Creating the Purchase Order or RFQ with suitable document type through ME21N or ME41 .
2) Executing the transaction ME9F and in selecting the suitable output type.
3) Executing the transaction ZSEND_PDOC using INT as input.
4) With above steps we can able to send purchase order or RFQ to vendor as an attachment through e-mail in PDF format.
Regards
Badari -
Cannot send email. When I click Write the window does not open properly. Does not have the "send, spelling, attach, security, save line there. Then when I click File, then Send now it will not send. A message comes up saying my SMTP server failed. Have check and everything appears to be o.k.
Hi Stephen,
What version of MS Office are you using?
Are you facing the issue similar to that mentioned here: Acrobat/Reader: Attach to Email button not working for PDFs referenced from long URLs
Open Acrobat. Use the click-path Edit - Preferences - select the Category "Email Accounts". In the dialog there is the "Add Account" drop-down. Select "Add Other". The "Add Webmail Account" dialog presents. You'll fill out the dialog's fields with Outlook.com settings. (don't forget the "Advance Settings" button)
From a look-see on the web it appears that the following are the needed settings. BUT, you'll be wanting to validate.
The Outlook.com SMTP server settings for sending outgoing messages from an email program on desktop, cell phone or mobile device are:
• Outlook.com SMTP server address: smtp.live.com
• Outlook.com SMTP user name: Your full Outlook.com email address (not an alias)
• Outlook.com SMTP password': Your Outlook.com password
• Outlook.com SMTP port: 587
• Outlook.com SMTP TLS/SSL encryption required: yes
For incoming messages from an Outlook.com account to an email program using POP, use the Windows Live Hotmail POP3 server settings.
The Outlook.com POP server settings for downloading new incoming messages to email program, cell phone or mobile device are:
• Outlook.com POP server address: pop3.live.com
• Outlook.com POP user name: Your full Outlook.com email address (not an alias)
• Outlook.com POP password: Your Outlook.com password
• Outlook.com POP port: 995
• Outlook.com POP TLS/SSL encryption required: yes
Regards,
Rave -
How to send PDF attachment through Email For Purchase Order
Hi,
Can you please tell me how to send the Purchase Order with PDF attachment. Thank you.
Thanks & Regards,
Rani.Find the below example
*& Report ZSPOOLTOPDF *
*& Converts spool request into PDF document and emails it to *
*& recipicant. *
*& Execution *
*& This program must be run as a background job in-order for the write *
*& commands to create a Spool request rather than be displayed on *
*& screen *
REPORT zspooltopdf.
PARAMETER: p_email1 LIKE somlreci1-receiver
DEFAULT '[email protected]',
p_sender LIKE somlreci1-receiver
DEFAULT '[email protected]',
p_delspl AS CHECKBOX.
*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.
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 sy-batch EQ 'X'.
PERFORM get_job_details.
PERFORM obtain_spool_id.
Alternative way could be to submit another program and store spool
id into memory, will be stored in sy-spono.
*submit ZSPOOLTOPDF2
to sap-spool
spool parameters %_print
archive parameters %_print
without spool dynpro
and return.
Get spool id from program called above
IMPORT w_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.
ELSE.
SKIP.
WRITE:/ 'Program must be executed in background in-order for spool',
'request to be created.'.
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 if helpful.
Thanks,
Kishore S N -
<satellite:form method="post" id="contact-form" enctype="multipart/form-data">
<input type="file" name="adjunto" />
</satellite:form>
FTValList ftListaFichero = new FTValList(1);
ftListaFichero.setValBLOB(ics.GetVar("adjunto_file"), ics.GetBin("adjunto"));
<mail:send
to="<%=to_emailaddress %>"
from="<%=from_emailaddress%>"
subject="Subject"
body="<%=body %>" >
<mail:attachment value='<%=ftListaFichero.getVal(ics.GetVar("adjunto_file"))%>'/>
</mail:send>
http://docs.oracle.com/cd/E29542_01/apirefs.1111/e39371/JSP/mail-attachment.html
http://docs.oracle.com/cd/E29542_01/apirefs.1111/e39371/JSP/mail-send.html
Regards,Simplest might well be to use javamail API instead of the two tags that Sites provides, e.g. see email - Sending mail attachment using Java - Stack Overflow for a full example.
Phil -
Right click file and send as attachment to email
can someone point me in the right direction on this. i want to be able to right click on a file and have an option to send email with the selected file(s) attached.
thanksVery simple, it only takes one action.
Create a workflow with the *New Mail Message* action, and that's all you need in it. Save this as a Finder plug-in with a nice name such as "New Email", or any name that makes sense to you.
When you use your right-click, choose the More menu and then the Automator menu inside that, and in there you'll see it in there by whatever name you gave it when you saved it.
You can find out more how the *New Mail Message* action works with and without files by reading its description. -
I cannot send emails with pics using the stock email app on my new Droid Turbo, it holds them in the Outbox and won't send even if I move to Inbox and resend
First check to make sure you have data turned on and not just Wi-Fi. From reading your question you seem to be saying e mail is working just not attached photos. What size are the photos as some HD photos can't be sent. Your camera may be set at a very high picture size and you can go to settings and lower the size and that may solve your mailing problem.
-
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 -
BPEL send email with attachment
Hi guys,,
Now i want to send email with attachment from the bpel console. In bpel console, if i want to use, "browse" button, how can i create this button in my xsd file?Hello,
Well I'm using the BPEL build in decoder. It works for txt file but how about PDF? Will it be the same?
it give me this message in the email process.
XML Parsing Error: reference to invalid character number
p/s: it working to txt but not pdf.
below is the script
<bpelx:exec name="decoder" language="java" version="1.5">
<![CDATA[String inputString = new String();
inputString =(String)getVariableData("attachmentContentVar");
try {
String decoded = Base64Decoder.decode(inputString);
setVariableData("decoded",decoded);
catch(Exception e)
e.printStackTrace();
}]]>
</bpelx:exec>
<copy>
<from variable="retriveAttachment_retriveAttachmentSelect_TASKID_OutputVariable"
part="WfattachmentCollection"
query="/ns3:WfattachmentCollection/ns3:Wfattachment/ns3:encoding"/>
<to variable="varNotificationReq" part="EmailPayload"
query="/EmailPayload/ns1:Content/ns1:ContentBody/ns1:MultiPart/ns1:BodyPart[2]/ns1:MimeType"/>
</copy>
<copy>
<from variable="retriveAttachment_retriveAttachmentSelect_TASKID_OutputVariable"
part="WfattachmentCollection"
query="/ns3:WfattachmentCollection/ns3:Wfattachment/ns3:name"/>
<to variable="varNotificationReq" part="EmailPayload"
query="/EmailPayload/ns1:Content/ns1:ContentBody/ns1:MultiPart/ns1:BodyPart[2]/ns1:BodyPartName"/>
</copy>
<copy>
<from expression="bpws:getVariableData('decoded')"/>
<to variable="varNotificationReq" part="EmailPayload"
query="/EmailPayload/ns1:Content/ns1:ContentBody/ns1:MultiPart/ns1:BodyPart[2]/ns1:ContentBody"/>
</copy>
</assign>
Edited by: kpchong on Oct 20, 2009 12:00 AM -
Send Email with attachment further .
Hello All,
Thank Raja Thangamani for giving me an answer about <b>Send Email with attachment</b> . But now I have a new question that when I sene Email with attachment beyond 500M , this funtion is not applied .
Pls give me some advice! Thanks very much!Look at this link & thread..
http://www.thespot4sap.com/Articles/SAP_Mail_UNIX_Example_ABAP.asp
Send PDF Attachment to SAP Mail Inbox.
Hope this will solve your problem.
Raja T
Message was edited by:
Raja Thangamani -
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 -
Send email with PDF attachements (Smartform/SAP script)
Hello All,
I have 3 existing programs A, B & C whose output is in SAP Script/Smartform. Now I need to create new program D which needs to execute program A, B & C and then convert their smartform/SAP script output into PDF format and send email with attachements (PDF files). Any pointers how I can proceed. Thanks a lot.hi Sarita,
v_ctrlparams-no_dialog = 'X'.
v_ctrlparams-getotf = 'X'.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'Smartform name'
IMPORTING
fm_name = v_func_mod.
CALL FUNCTION v_func_mod
EXPORTING
control_parameters = v_ctrlparams
IMPORTING
job_output_info = v_joboutput
TABLES
t_nonsigner = t_nonsigner.
fill the document
doc_chng-obj_name = 'Descriptoipn'.
Fill the subject line
doc_chng-obj_descr = 'Manpowe'.
doc_chng-obj_descr = 'Reminder .
doc_chng-sensitivty = 'P'.
Fill the content of the mail
objcont = 'Dear all,'.
APPEND objcont.
CLEAR objcont.
APPEND objcont.
CLEAR objcont.
objcont =
'The manpower sign-off is pending for the list of employees as per th' &
'e attached sheet.'
APPEND objcont.
CLEAR objcont.
APPEND objcont.
CLEAR objcont.
objcont =
'Please click on the following link for the manpower sign-off:'.
APPEND objcont.
CLEAR objcont.
APPEND objcont.
CLEAR objcont.
DESCRIBE TABLE objcont LINES entries.
READ TABLE objcont INDEX entries.
doc_chng-doc_size = ( entries - 1 ) * 255 + STRLEN( objcont ).
Creating the entry for the compressed document
CLEAR objpack-transf_bin.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = entries.
objpack-doc_type = 'RAW'.
APPEND objpack.
Creating the document attachment
(Assume the data in OBJBIN are given in BMP format)
LOOP AT v_joboutput-otfdata INTO wa_otfdata.
APPEND wa_otfdata TO objbin.
CLEAR wa_otfdata.
ENDLOOP.
DESCRIBE TABLE objbin LINES tab_lines.
objhead = 'NonSignerDetails.otf'. APPEND objhead.
Creating the entry for the compressed attachment
objpack-transf_bin = 'X'.
objpack-head_start = 1.
objpack-head_num = 1.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = 'OTF'.
objpack-obj_name = 'ATTACHMENT'.
objpack-obj_descr = 'NonSignerDetails'.
objpack-doc_size = tab_lines * 255.
APPEND objpack.
Sending the document
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = doc_chng
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = objpack
object_header = objhead
contents_bin = objbin
contents_txt = objcont
receivers = reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
operation_no_authorization = 4
OTHERS = 99.
hope this will help u..
regards,
Santosh Thorat -
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 -
Email crashing and taking too long to send an attachment of 500 KB
Well I have a brand new MBP $C i7 2.5 GHz 8GB RAM with clean installed in its 1st week. The email is crashing when I try to send the attachment bigger than 1 MB. It slows down everything when I try to send a normal email and the time it takes to send a simple email is 3 to 5 minutes .
What I have done so far:
Clean install
Change the app to 32-bit run it, quit it, change back to 64-bit and run it. Repeaed many times
Nothing is working out now.
From logs I can see that the mail app is using too much memory and processor while running. Help pleaseAre you using Transport.send to send each batch? Or are you using a single
Transport object that you connect before the first message and close after
the last message? If you're doing the former, try the latter, it will likely be much
faster.
Also, sendmail may be configured to throttle the rate at which you can send
messages; you might want to check with a sendmail expert on that.
Maybe you are looking for
-
How to clean everything off iBook
Hello folks, I am trying to prep an iBook to give it away (sorry, spoken for), and I need to remove all the personal info, files, keychains as well as reset settings, etc. I haven't ever done this and I wondered if there was any reliable way to go ab
-
Certain keys on midi keyboard no longer seem to be recognized -
Hi all, I've done my best to read through all the existing posts on similar topics but haven't been able to solve this seemingly odd but probably simple issue. I'm at the end of my wits, hope someone can help! I have been using an M-Audio Axiom 25 wi
-
Guidance required for excel processing
Hai I am new to Excel documents processing in java.I have tried jxl . Now i hear about jakarta POI.Can you tell which is the best method ? I will be grateful if you provide me some links to get started. Thanks in advance
-
Whoa!!! what did I do.
I got a message my mighty mouse batteries were low. I changed them out and my computer went haywire. When I open a browser it just fills in all zeros and it makes a constant repeated sound like if you havent clicked yes and you try to do another func
-
Cannot get Dell laptop to recognize 30GB 5th gen. Ipod in any way!
I've followed all of the steps on both Apple and Dell's websites that could supposedly be the cause of this problem and have not had any success! I think it may be a matter of installing an outside driver, but I'm not sure I know what to do once the