Email with attachment disappearing after i select it...
email questions...
i also have experienced my email completely disappearing after i open it - all of these emails have had attachement in .xls or .doc or .mov format. i really don't want my emails disappearing without me saying so. anyone else had this happen?
also, says downloading "x" more number of emails but nothing comes in.
robm2009 wrote:
Hi Texas: No my iPad is not jailbroken. I'm really just asking whether the built-in email program on an iPad is encrypted or if someone on the same free WIFI network as I am on is able to see my login and password with a sniffer program (or some such program).
Thanks!
All passwords on iOS based apps is encrypted. It is extrememly unlikely your iPad and that WiFi connection is where the problem lays. In fact, it is quite possible your actual email account wasn't used: The sender address could easily have been spoofed. The email itself is not encrypted (very few mail apps/providers do this), and unless you are in a situation where the mail you send is of such a nature as to be that confidential, encrypting email will be more trouble that it is worth (your recipients will need the encryption key to read it).
Contact support for hotmail and change your password. You might consider changing yoru email address or even provider, but ther eis a chance that wouldn't stop the spam.
Similar Messages
-
New email with attachment action disappeared from Finder
Does anybody know what might have happened? I've been using this action for some time, and after upgrading to Mountain Lion it stopped working. Then after some time I discovered that the action is no longer available in the Finder context menu.
Note: I'm using Bitcasa, and the Bitcasa client added some actions of its own under an option called "services".The action "new email with attachment appeared under "services" as well.
I don't think it's a Bitcasa problem as it's been working just fine for several months now. It crapped out after upgrading to ML.Nevermind, figured it out elsewhere on the suport forum.
https://discussions.apple.com/thread/4139642?start=15&tstart=0
Aruk
Do this from in the mail app. Change it to Mail 6.0.
"Hey, mine seems to be working now, what i did; i change the email preferences>general the first options reads: "default email reader" mine used to read "google chrome", after i changed the preferences the "share" button now shows all the options including "email". hope this helps in some way:D" -
Hi All
We are successfully able to send email with attachment on sql prompt. The problem is when we are trying to send the attachment through Application Express after submit process its showing the attached file but without its content.
We hav created two such processes. Process one attachs the file as below
declare
file_id number;
begin
delete from dumy_file;
select nvl(max(id),0)+1 into file_id from dumy_file;
insert into dumy_file(id,name,file_obj_id,mime_type,blob_content)
select file_id, filename, id ,mime_type,blob_content
from htmldb_application_files where name = :P2_FILE;
:P2_X := file_id;
end;
And process two send the email with attachment:
declare
file_name varchar2(100);
mim_typ varchar2(50);
begin
select name into file_name from dumy_file where id = :P2_X;
select MIME_TYPE into mim_typ from dumy_file where id = :P2_X;
email_files(from_name => 'Aashu' ,
to_names => :P2_EMAIL,
subject => 'A test from APEX',
message => 'A test message from APEX',
html_message => 'A test message from APEX',
filename1 => file_name,
filetype1 => mim_typ);
end;
Here dumy_file is a custom table.
Any help would be highly appreciated.
Thanks
saurabh[rem Purpose: Sends e-mail (text and/or html, either as a string or from a file)
rem to one or more recipients (including cc and/or bcc recipients), along with
rem up to 3 file attachments (text and/or binary; default is text/plain), using
rem the UTL_SMTP package to send the e-mail, the DBMS_LOB package to read
rem binary file attachments, and the UTL_ENCODE package to convert the binary
rem attachments to BASE64 for character string (non-binary) transmission.
rem BE AWARE THAT A COMMIT MAY BE DONE BY THIS ROUTINE (see HOWEVER... below).
rem
rem The complete parameter list for the email_files procedure is shown below:
rem from_name - name and e-mail address to put in the From field
rem to_names - names and e-mail addresses for the To field (separated by
rem commas or semicolons)
rem subject - text string for Subject field
rem message - text string or text file name for Message, if any
rem html_message - html string or html file name for Message, if any
rem cc_names - names and e-mail addresses for the Cc field, if any
rem (separated by commas or semicolons)
rem bcc_names - names and e-mail addresses for the Bcc field, if any
rem (separated by commas or semicolons)
rem filename1 - first file pathname to attach, if any
rem filetype1 - mime type of first file (defaults to 'text/plain')
rem filename2 - second file pathname to attach, if any
rem filetype2 - mime type of second file (defaults to 'text/plain')
rem filename3 - third file pathname to attach, if any
rem filetype3 - mime type of third file (defaults to 'text/plain')
rem
rem Sample names and e-mail addresses are: srea (attaches @<localhost> or
rem @<mail domain>), [email protected], <[email protected]>, Steve Rea <[email protected]>,
rem and "Steve Rea" <[email protected]> (e-mail addresses must be valid - validity
rem checking is not done on them).
rem
rem A sample call in PL/SQL is shown below, which sends a text and html message,
rem plus a text file and two binary files (note: the slash after "end;" must be
rem the first character on it's line):
rem
rem begin
rem email_files(from_name => 'oracle' ,
rem to_names => '[email protected]',
rem subject => 'A test',
rem message => 'A test message',
rem html_message => '<h2>A <u><i>test</i></u> message</h2>',
rem filename1 => '/tmp/web_ptrbdca.txt',
rem filename2 => '/tmp/password_standards.pdf',
rem filetype2 => 'application/pdf',
rem filename3 => '/tmp/wb703.jpg',
rem filetype3 => 'image/jpeg');
rem end;
rem /
rem
rem If the message or html_message string has a file name in it (starting with
rem a forward slash for unix or starting with '<drive letter>:\' or '\\' for
rem Windows/DOS), the text or html file is copied into the e-mail as the message
rem or html message; otherwise, the message or html_message is copied into the
rem e-mail as-is.
rem
rem Attachment file types (mime types) that I've tested include:
rem text/plain, text/html, image/jpeg, image/gif, application/pdf,
rem application/msword
rem A list of mime types can be seen at:
rem http://www.webmaster-toolkit.com/mime-types.shtml
rem If the mime type does not begin with "text", it is assumed to be a binary
rem file that will be encoded as base64 before transmission.
rem
rem This was derived from several sources, including:
rem Dave Wotton (Cambridge UK) - mail_files.sql at
rem http://home.clara.net/dwotton/dba/oracle_smtp.htm
rem Oracle Technology Network - maildemo.sql (demo_mail) at
rem http://www.oracle.com/technology/sample_code/tech/pl_sql/htdocs/Utl_Smtp_Sample.html
rem Akadia's "Read a file word by word using DBMS_LOB" Tip at
rem http://www.akadia.com/services/read_file_with_dbms_lob.html
rem Tom Kyte of Oracle's AskTom site (http://AskTom.oracle.com) -
rem answer to "File Exists which is not a BFILE" and others.
rem
rem NOTE: The user running this must have "create any directory" and "drop any
rem directory" privileges ("create directory" was introduced in Oracle 9iR2),
rem which must be granted from a system or dba account, such as:
rem grant create any directory to scott;
rem grant drop any directory to scott;
rem then:
rem connect / as sysdba
rem grant select on dba_directories to scott;
rem or, for everyone to have directory privileges:
rem grant create any directory to public;
rem grant drop any directory to public;
rem then:
rem connect / as sysdba
rem grant select on dba_directories to public;
rem Any file in any directory accessible to the user can be attached (not just
rem the directories listed for the utl_file_dir parameter in the init.ora file).
rem HOWEVER, if you are using this to send e-mail's with attached files (or
rem reading the message text or message html from a file) from a trigger or
rem from some other SQL that you can't or don't want to have a commit done,
rem you will first need to create an Oracle directory entry for the directory
rem containing the attached files and grant read access to it to public, such
rem as:
rem create directory CESDIR_COMMON as '/home/common';
rem grant read on directory CESDIR_COMMON to public;
rem
rem You may also want to create a public synonym for this procedure, from the
rem procedure's owner:
rem create or replace public synonym email_files for email_files;
rem grant execute on email_files to public;
rem
rem FYI: I tried using the utl_file package to read binary files:
rem utl_file.get_raw(v_file_handle,data,57);
rem but got "ORA-29284: file read error" on .pdf files, so, I switched to use
rem the dbms_lob package to read binary files:
rem dbms_lob.read(v_bfile_handle,read_bytes,v_pos,data);
rem
rem Author: Stephen Rea <[email protected]>
rem University of Arkansas Cooperative Extension Service
rem Initial release: 12/21/04
rem
rem Updates:
rem 1/31/05 - Fixed for triggers and other SQL that can't have a commit by
rem checking for and using already-defined Oracle directories ("create
rem directory" is a DDL statement that does a commit).
rem 9/23/05 - Put exception handler in to handle the SMTP server being
rem down or unavailable. (Solution from Ed Siegle at Swarthmore.)
rem 7/14/06 - Additional changes to detect and handle Windows/DOS file names
rem (second and third characters ':\' for paths with drive letters, or
rem first and second characters '\\' for UNC paths).
rem 8/25/06 - Some SMTP interfaces may require angle brackets (<>) around the
rem e-mail addresses, so, add them before returning results from get_address.
rem Also, they may not attach the host if relayed through a non-localhost,
rem so, attach the mail domain part (last two components) of the relay host
rem to the address if the mail domain is not specified in the address.
rem
create or replace procedure email_files(from_name varchar2,
to_names varchar2,
subject varchar2,
message varchar2 default null,
html_message varchar2 default null,
cc_names varchar2 default null,
bcc_names varchar2 default null,
filename1 varchar2 default null,
filetype1 varchar2 default 'text/plain',
filename2 varchar2 default null,
filetype2 varchar2 default 'text/plain',
filename3 varchar2 default null,
filetype3 varchar2 default 'text/plain')
is
-- Change the SMTP host name and port number below to your own values,
-- if not localhost on port 25:
smtp_host varchar2(256) := 'localhost';
smtp_port number := 25;
-- Change the boundary string, if needed, which demarcates boundaries of
-- parts in a multi-part email, and should not appear inside the body of
-- any part of the e-mail:
boundary constant varchar2(256) := 'CES.Boundary.DACA587499938898';
recipients varchar2(32767);
directory_path varchar2(256);
file_name varchar2(256);
crlf varchar2(2):= chr(13) || chr(10);
mesg varchar2(32767);
conn UTL_SMTP.CONNECTION;
type varchar2_table is table of varchar2(256) index by binary_integer;
file_array varchar2_table;
type_array varchar2_table;
i binary_integer;
my_code number;
my_errm varchar2(32767);
-- Function to return the next email address in the list of email addresses,
-- separated by either a "," or a ";". From Oracle's demo_mail. The format
-- of mailbox may be in one of these:
-- someone@some-domain
-- "Someone at some domain" <someone@some-domain>
-- Someone at some domain <someone@some-domain>
FUNCTION get_address(addr_list IN OUT VARCHAR2) RETURN VARCHAR2 IS
addr VARCHAR2(256);
i pls_integer;
FUNCTION lookup_unquoted_char(str IN VARCHAR2,
chrs IN VARCHAR2) RETURN pls_integer IS
c VARCHAR2(5);
i pls_integer;
len pls_integer;
inside_quote BOOLEAN;
BEGIN
inside_quote := false;
i := 1;
len := length(str);
WHILE (i <= len) LOOP
c := substr(str, i, 1);
IF (inside_quote) THEN
IF (c = '"') THEN
inside_quote := false;
ELSIF (c = '\') THEN
i := i + 1; -- Skip the quote character
END IF;
GOTO next_char;
END IF;
IF (c = '"') THEN
inside_quote := true;
GOTO next_char;
END IF;
IF (instr(chrs, c) >= 1) THEN
RETURN i;
END IF;
<<next_char>>
i := i + 1;
END LOOP;
RETURN 0;
END;
BEGIN
addr_list := ltrim(addr_list);
i := lookup_unquoted_char(addr_list, ',;');
IF (i >= 1) THEN
addr := substr(addr_list, 1, i - 1);
addr_list := substr(addr_list, i + 1);
ELSE
addr := addr_list;
addr_list := '';
END IF;
i := lookup_unquoted_char(addr, '<');
IF (i >= 1) THEN
addr := substr(addr, i + 1);
i := instr(addr, '>');
IF (i >= 1) THEN
addr := substr(addr, 1, i - 1);
END IF;
END IF;
i := lookup_unquoted_char(addr, '@');
IF (i = 0 and smtp_host != 'localhost') THEN
i := instr(smtp_host, '.', -1, 2);
addr := addr || '@' || substr(smtp_host, i + 1);
END IF;
addr := '<' || addr || '>';
RETURN addr;
END;
-- Procedure to split a file pathname into its directory path and file name
-- components.
PROCEDURE split_path_name(file_path IN VARCHAR2, directory_path OUT VARCHAR2,
file_name OUT VARCHAR2) IS
pos number;
begin
-- Separate the filename from the directory name
pos := instr(file_path,'/',-1);
if pos = 0 then
pos := instr(file_path,'\',-1);
end if;
if pos = 0 then
directory_path := null;
else
directory_path := substr(file_path,1,pos - 1);
end if;
file_name := substr(file_path,pos + 1);
end;
-- Procedure to append a file's contents to the e-mail
PROCEDURE append_file(directory_path IN VARCHAR2, file_name IN VARCHAR2,
file_type IN VARCHAR2, conn IN OUT UTL_SMTP.CONNECTION) IS
generated_name varchar2(30) := 'CESDIR' || to_char(sysdate,'HH24MISS');
directory_name varchar2(30);
file_handle utl_file.file_type;
bfile_handle bfile;
bfile_len number;
pos number;
read_bytes number;
line varchar2(1000);
data raw(200);
my_code number;
my_errm varchar2(32767);
begin
begin
-- Grant access to the directory, unless already defined, and open
-- the file (as a bfile for a binary file, otherwise as a text file).
begin
line := directory_path;
select dd.directory_name into directory_name from dba_directories dd
where dd.directory_path = line and rownum = 1;
exception
when no_data_found then
directory_name := generated_name;
end;
if directory_name = generated_name then
execute immediate 'create or replace directory ' || directory_name ||
' as ''' || directory_path || '''';
execute immediate 'grant read on directory ' || directory_name ||
' to public';
end if;
if substr(file_type,1,4) != 'text' then
bfile_handle := bfilename(directory_name,file_name);
bfile_len := dbms_lob.getlength(bfile_handle);
pos := 1;
dbms_lob.open(bfile_handle,dbms_lob.lob_readonly);
else
file_handle := utl_file.fopen(directory_name,file_name,'r');
end if;
-- Append the file contents to the end of the message
loop
-- If it is a binary file, process it 57 bytes at a time,
-- reading them in with a LOB read, encoding them in BASE64,
-- and writing out the encoded binary string as raw data
if substr(file_type,1,4) != 'text' then
if pos + 57 - 1 > bfile_len then
read_bytes := bfile_len - pos + 1;
else
read_bytes := 57;
end if;
dbms_lob.read(bfile_handle,read_bytes,pos,data);
utl_smtp.write_raw_data(conn,utl_encode.base64_encode(data));
pos := pos + 57;
if pos > bfile_len then
exit;
end if;
-- If it is a text file, get the next line of text, append a
-- carriage return / line feed to it, and write it out
else
utl_file.get_line(file_handle,line);
utl_smtp.write_data(conn,line || crlf);
end if;
end loop;
-- Output any errors, except at end when no more data is found
exception
when no_data_found then
null;
when others then
my_code := SQLCODE;
my_errm := SQLERRM;
dbms_output.put_line('Error code ' || my_code || ': ' ||
my_errm);
end;
-- Close the file (binary or text)
if substr(file_type,1,4) != 'text' then
dbms_lob.close(bfile_handle);
else
utl_file.fclose(file_handle);
end if;
if directory_name = generated_name then
execute immediate 'drop directory ' || directory_name;
end if;
end;
begin
-- Load the three filenames and file (mime) types into an array for
-- easier handling later
file_array(1) := filename1;
file_array(2) := filename2;
file_array(3) := filename3;
type_array(1) := filetype1;
type_array(2) := filetype2;
type_array(3) := filetype3;
-- Open the SMTP connection and set the From and To e-mail addresses
conn := utl_smtp.open_connection(smtp_host,smtp_port);
utl_smtp.helo(conn,smtp_host);
recipients := from_name;
utl_smtp.mail(conn,get_address(recipients));
recipients := to_names;
while recipients is not null loop
utl_smtp.rcpt(conn,get_address(recipients));
end loop;
recipients := cc_names;
while recipients is not null loop
utl_smtp.rcpt(conn,get_address(recipients));
end loop;
recipients := bcc_names;
while recipients is not null loop
utl_smtp.rcpt(conn,get_address(recipients));
end loop;
utl_smtp.open_data(conn);
-- Build the start of the mail message
mesg := 'Date: ' || TO_CHAR(SYSDATE,'dd Mon yy hh24:mi:ss') || crlf ||
'From: ' || from_name || crlf ||
'Subject: ' || subject || crlf ||
'To: ' || to_names || crlf;
if cc_names is not null then
mesg := mesg || 'Cc: ' || cc_names || crlf;
end if;
if bcc_names is not null then
mesg := mesg || 'Bcc: ' || bcc_names || crlf;
end if;
mesg := mesg || 'Mime-Version: 1.0' || crlf ||
'Content-Type: multipart/mixed; boundary="' || boundary || '"' ||
crlf || crlf ||
'This is a Mime message, which your current mail reader may not' || crlf ||
'understand. Parts of the message will appear as text. If the remainder' || crlf ||
'appears as random characters in the message body, instead of as' || crlf ||
'attachments, then you''ll have to extract these parts and decode them' || crlf ||
'manually.' || crlf || crlf;
utl_smtp.write_data(conn,mesg);
-- Write the text message or message file, if any
if message is not null then
mesg := '--' || boundary || crlf ||
'Content-Type: text/plain; name="message.txt"; charset=US-ASCII' ||
crlf ||
'Content-Disposition: inline; filename="message.txt"' || crlf ||
'Content-Transfer-Encoding: 7bit' || crlf || crlf;
utl_smtp.write_data(conn,mesg);
if instr(message,'/') = 1 or instr(message,':\') = 2 or
instr(message,'\\') = 1 then
split_path_name(message,directory_path,file_name);
append_file(directory_path,file_name,'text',conn);
utl_smtp.write_data(conn,crlf);
else
utl_smtp.write_data(conn,message || crlf);
end if;
end if;
-- Write the HTML message or message file, if any
if html_message is not null then
mesg := '--' || boundary || crlf ||
'Content-Type: text/html; name="message.html"; charset=US-ASCII' ||
crlf ||
'Content-Disposition: inline; filename="message.html"' || crlf ||
'Content-Transfer-Encoding: 7bit' || crlf || crlf;
utl_smtp.write_data(conn,mesg);
if instr(html_message,'/') = 1 or instr(html_message,':\') = 2 or
instr(html_message,'\\') = 1 then
split_path_name(html_message,directory_path,file_name);
append_file(directory_path,file_name,'text',conn);
utl_smtp.write_data(conn,crlf);
else
utl_smtp.write_data(conn,html_message || crlf);
end if;
end if;
-- Append the files
for i in 1..3 loop
-- If the filename has been supplied ...
if file_array(i) is not null then
split_path_name(file_array(i),directory_path,file_name);
-- Generate the MIME boundary line according to the file (mime) type
-- specified.
mesg := crlf || '--' || boundary || crlf;
if substr(type_array(i),1,4) != 'text' then
mesg := mesg || 'Content-Type: ' || type_array(i) ||
'; name="' || file_name || '"' || crlf ||
'Content-Disposition: attachment; filename="' ||
file_name || '"' || crlf ||
'Content-Transfer-Encoding: base64' || crlf || crlf ;
else
mesg := mesg || 'Content-Type: application/octet-stream; name="' ||
file_name || '"' || crlf ||
'Content-Disposition: attachment; filename="' ||
file_name || '"' || crlf ||
'Content-Transfer-Encoding: 7bit' || crlf || crlf ;
end if;
utl_smtp.write_data(conn,mesg);
-- Append the file contents to the end of the message
append_file(directory_path,file_name,type_array(i),conn);
utl_smtp.write_data(conn,crlf);
end if;
end loop;
-- Append the final boundary line
mesg := crlf || '--' || boundary || '--' || crlf;
utl_smtp.write_data(conn,mesg);
-- Close the SMTP connection
utl_smtp.close_data(conn);
utl_smtp.quit(conn);
exception
when utl_smtp.transient_error or utl_smtp.permanent_error then
my_code := SQLCODE;
my_errm := SQLERRM;
begin
utl_smtp.quit(conn);
exception
when utl_smtp.transient_error or utl_smtp.permanent_error then
null;
end;
raise_application_error(-20000,
'Failed to send mail - SMTP server down or unavailable: Error code ' ||
my_code || ': ' || my_errm);
when others then
my_code := SQLCODE;
my_errm := SQLERRM;
raise_application_error(-20000,
'Failed to send mail: Error code ' || my_code || ': ' || my_errm);
end;
Above is the code as required by you.In my original mail I have explained that how I'm calling this procedure.
Thanks
Saurabh -
Problem by Sending an Email with attached Adobe Interactive Form (Code)
Thanks. I have written Programm, but it does not work as i want it to do. I will send an Email with attached Adobe Interactive Firm to [email protected]. I tried it with "*lo_recipient = cl_sapuser_bcs=>create( sy-uname )" at the marked(bold, fat) position. It worked but the Email was send to my SAP-Account, but i want to send to [email protected], so I tried this (see at code in bold, fat):
lo_rec TYPE adr6-smtp_addr VALUE '[email protected]'. " Empfänger Receiver
lo_recipient = cl_cam_address_bcs=>create_internet_address( lo_rec ).
But it doens`t send the email.
Can anybody help me please???
Kevin
Here my Code:
Report FP_EXAMPLE_01
Printing of documents using PDF based forms
REPORT z_example_02.
Data declaration
DATA: carr_id TYPE sbook-carrid,
customer TYPE scustom,
bookings TYPE ty_bookings,
connections TYPE ty_connections,
fm_name TYPE rs38l_fnam,
fp_docparams TYPE sfpdocparams,
fp_outputparams TYPE sfpoutputparams,
error_string TYPE string,
l_booking TYPE sbook,
t_sums TYPE TABLE OF sbook,
l_sums LIKE LINE OF t_sums,
fp_formoutput TYPE fpformoutput.
PARAMETER: p_custid TYPE scustom-id DEFAULT 38.
SELECT-OPTIONS: s_carrid FOR carr_id DEFAULT 'AA' TO 'ZZ'.
PARAMETER: p_form TYPE tdsfname DEFAULT 'FP_EXAMPLE_01'.
PARAMETER: language TYPE sfpdocparams-langu DEFAULT 'E'.
PARAMETER: country TYPE sfpdocparams-country DEFAULT 'US'.
Get data from the following tables: scustom(Flight customer)
sbook (Single flight reservation)
spfli (Flight plan)
SELECT SINGLE * FROM scustom INTO customer WHERE id = p_custid.
CHECK sy-subrc = 0.
SELECT * FROM sbook INTO TABLE bookings
WHERE customid = p_custid
AND carrid IN s_carrid
ORDER BY PRIMARY KEY.
SELECT * FROM spfli INTO TABLE connections
FOR ALL ENTRIES IN bookings
WHERE carrid = bookings-carrid
AND connid = bookings-connid
ORDER BY PRIMARY KEY.
Print data:
First get name of the generated function module
CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'
EXPORTING
i_name = p_form
IMPORTING
e_funcname = fm_name.
IF sy-subrc <> 0.
MESSAGE e001(fp_example).
ENDIF.
Set output parameters and open spool job
fp_outputparams-nodialog = 'X'. " suppress printer dialog popup
fp_outputparams-getpdf = 'X'. " launch print preview
CALL FUNCTION 'FP_JOB_OPEN'
CHANGING
ie_outputparams = fp_outputparams
EXCEPTIONS
cancel = 1
usage_error = 2
system_error = 3
internal_error = 4
OTHERS = 5.
Set form language and country (->form locale)
fp_docparams-langu = language.
fp_docparams-country = country.
*fp_docparams-fillable = 'X'.
*fp_docparams-langu = 'E'. "wird jetzt automatisch gesetzt, bzw. kann dynamisch verändert werden
*fp_docparams-country = 'GB'. "wird jetzt automatisch gesetzt, bzw. kann dynamisch verändert werden
currency key dependant summing
LOOP AT bookings INTO l_booking.
l_sums-forcuram = l_booking-forcuram.
l_sums-forcurkey = l_booking-forcurkey.
COLLECT l_sums INTO t_sums.
ENDLOOP.
Now call the generated function module
CALL FUNCTION fm_name
EXPORTING
/1bcdwb/docparams = fp_docparams
customer = customer
bookings = bookings
connections = connections
t_sums = t_sums
IMPORTING
/1bcdwb/formoutput = fp_formoutput
EXCEPTIONS
usage_error = 1
system_error = 2
internal_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
CALL FUNCTION 'FP_GET_LAST_ADS_ERRSTR'
IMPORTING
e_adserrstr = error_string.
IF NOT error_string IS INITIAL.
we received a detailed error description
WRITE:/ error_string.
EXIT.
ELSE.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDIF.
Close spool job
CALL FUNCTION 'FP_JOB_CLOSE'
EXCEPTIONS
usage_error = 1
system_error = 2
internal_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
*********************Send the form*******************
*********************to the Customer*****************
*********************via Email***********************
*IF i_down = abap_true.
DATA: filename TYPE string,
path TYPE string,
fullpath TYPE string,
default_extension TYPE string VALUE 'PDF'.
Data:
lt_att_content_hex TYPE solix_tab.
*DATA: data_tab TYPE TABLE OF x255.
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = fp_formoutput-pdf
TABLES
binary_tab = lt_att_content_hex.
CLASS cl_bcs DEFINITION LOAD.
DATA:
lo_send_request TYPE REF TO cl_bcs VALUE IS INITIAL.
lo_send_request = cl_bcs=>create_persistent( ).
DATA:
lt_message_body TYPE bcsy_text VALUE IS INITIAL.
DATA: lo_document TYPE REF TO cl_document_bcs VALUE IS INITIAL.
APPEND 'Dear Vendor,' TO lt_message_body.
APPEND ' ' TO lt_message_body.
APPEND 'Please fill the attached form and send it back to us.'
TO lt_message_body.
APPEND ' ' TO lt_message_body.
APPEND 'Thank You,' TO lt_message_body.
lo_document = cl_document_bcs=>create_document(
i_type = 'RAW'
i_text = lt_message_body
i_subject = 'Vendor Payment Form' ).
DATA: lx_document_bcs TYPE REF TO cx_document_bcs VALUE IS INITIAL.
TRY.
lo_document->add_attachment(
EXPORTING
i_attachment_type = 'PDF'
i_attachment_subject = 'Vendor Payment Form'
i_att_content_hex = lt_att_content_hex ).
CATCH cx_document_bcs INTO lx_document_bcs.
ENDTRY.
lo_send_request->set_document( lo_document ).
DATA:
lo_sender TYPE REF TO if_sender_bcs VALUE IS INITIAL,
lo_send TYPE adr6-smtp_addr VALUE '[email protected]'. "Absender SENDER
lo_sender = cl_cam_address_bcs=>create_internet_address( lo_send ).
Set sender
lo_send_request->set_sender(
EXPORTING
i_sender = lo_sender ).
Create recipient
DATA:
lo_recipient type ref to if_recipient_bcs value is initial.
Data:
lo_rec TYPE adr6-smtp_addr VALUE '[email protected]'. " Empfänger Receiver
lo_recipient = cl_cam_address_bcs=>create_internet_address( lo_rec ).
*lo_recipient = cl_sapuser_bcs=>create( sy-uname ).
Set recipient
lo_send_request->add_recipient(
EXPORTING
i_recipient = lo_recipient
i_express = 'X' ).
*lo_send_request->add_recipient(
*EXPORTING
*i_recipient = lo_recipient
*i_express = 'X' ).
Send email
DATA: lv_sent_to_all(1) TYPE c VALUE IS INITIAL.
lo_send_request->send(
EXPORTING
i_with_error_screen = 'X'
RECEIVING
result = lv_sent_to_all ).
COMMIT WORK.
MESSAGE 'The payment form has been emailed to the Vendor' TYPE 'I'.Hi Kevin,
Please try this code to send your mail, i wrote it and works well in many system.
Take care if in your profile you got an e-mail adress define .
Take care also of trnasaction SCOT customizing, are you able to send mail to e-mail adress ?
Let me know if it's works.
Best regards.
<i>**----
CLASS-DEFINITIONS
DATA: send_request TYPE REF TO cl_bcs.
DATA: document TYPE REF TO cl_document_bcs.
DATA: sender TYPE REF TO cl_sapuser_bcs.
DATA: recipient TYPE REF TO if_recipient_bcs.
INTERNAL TABLES
DATA: l_mailtext TYPE soli_tab.
DATA: iaddsmtp TYPE TABLE OF bapiadsmtp.
DATA: ireturn TYPE TABLE OF bapiret2.
VARIABLES
DATA: mail_line LIKE LINE OF l_mailtext.
DATA: bapiadsmtp TYPE bapiadsmtp.
DATA: subject TYPE so_obj_des.
DATA : att_subject TYPE so_obj_des.
DATA : w_except TYPE REF TO cx_root .
CONSTANTS : c_defmail TYPE ad_smtpadr VALUE
'[email protected]' .
FIELD-SYMBOLS : <smtp> TYPE bapiadsmtp.
*Convert the pdf given by function module into Binary .
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = output-pdf "PDF file from function module
TABLES
binary_tab = hexa.
*Set subject of the mail
subject = 'Exemple de PDF interactif'.
Set text of the mail
mail_line = 'Merci de remplir le formulaire et nous le retourner'.
APPEND mail_line TO l_mailtext .
Set the name of the attached document
att_subject = 'Template du PDF'.
TRY.
Create persistent send request
send_request = cl_bcs=>create_persistent( ).
Get sender object
sender = cl_sapuser_bcs=>create( sy-uname ).
Add sender
CALL METHOD send_request->set_sender
EXPORTING
i_sender = sender.
Read the E-Mail address for the user
CALL FUNCTION 'BAPI_USER_GET_DETAIL'
EXPORTING
username = sy-uname
TABLES
return = ireturn
addsmtp = iaddsmtp.
LOOP AT iaddsmtp ASSIGNING <smtp> WHERE std_no = 'X'.
CLEAR bapiadsmtp.
MOVE <smtp> TO bapiadsmtp.
ENDLOOP.
CASE bapiadsmtp-e_mail.
WHEN space.
No adress main for user, so send it to the default mail adress
recipient =
cl_cam_address_bcs=>create_internet_address( c_defmail ).
WHEN OTHERS.
recipient =
cl_cam_address_bcs=>create_internet_address( bapiadsmtp-e_mail ).
ENDCASE.
Add recipient with its respective attributes to send request
CALL METHOD send_request->add_recipient
EXPORTING
i_recipient = recipient
i_express = 'X'
i_copy = space
i_blind_copy = space
i_no_forward = space.
Set that you don't need a Return Status E-mail
CALL METHOD send_request->set_status_attributes
EXPORTING
i_requested_status = 'E'
i_status_mail = 'E'.
set send immediately flag
send_request->set_send_immediately( 'X' ).
*Build Document
document = cl_document_bcs=>create_document(
i_type = 'RAW'
i_text = l_mailtext
i_subject = subject ).
add attachment to document
CALL METHOD document->add_attachment
EXPORTING
i_attachment_type = 'PDF'
i_attachment_subject = att_subject
i_att_content_hex = hexa.
Add document to send request
CALL METHOD send_request->set_document( document ).
Send document
CALL METHOD send_request->send( ).
COMMIT WORK.
CATCH cx_send_req_bcs INTO w_except.
CATCH cx_address_bcs INTO w_except.
CATCH cx_document_bcs INTO w_except.
ENDTRY.</i> -
Sharepoint Online - Send email with attachment
Hi All,
is there some way how to send email with attachment, which is attached to list item in host web?
I tried some of solutions but none of them not working.
Server side:
For example event receiver after added list item with attachment - Because it is office 365, in SandBox solution I can´t use SmtpClient class.
Any other ideas?
Client side:
For example client web part with REST call. It works fine until I don´t need access to attachment.
string oDataUrlAttach = "/_api/Web/lists/getbytitle('ListName')/Items(6)/AttachmentFiles('Document.docx')/$value";
HttpWebRequest itemRequestAttach = (HttpWebRequest)HttpWebRequest.Create(sharepointUrl.ToString() + oDataUrlAttach);
itemRequest.Method = "GET";
itemRequest.Accept = "application/atom+xml";
itemRequest.ContentType = "application/atom+xml;type=entry";
itemRequest.Headers.Add("Authorization", "Bearer " + accessToken);
HttpWebResponse itemResponseAttach = (HttpWebResponse)itemRequestAttach.GetResponse();
Here I get error: The remote server returned an error: (403) Forbidden.
But other calls are OK. I can get all items from my list except attachments.
Any ideas?
Thank you.Why hasn't this been answered?
Sam Ogle -
How to send an email with attachment to dynamic emial address using PL/SQL
Hi,
i want to send an automated email with attachment everyday to differnet people so number people is not static.
so is it any way using PL/SQL ?
thanks for your support!i want to send an automated email with attachment everyday to differnet people so number people is not static.
Why? Explain it.
You can create a table and store your email id through front-end application day to day.
The table should look like this ->
satyaki>
satyaki>select * from v$version;
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Prod
PL/SQL Release 10.2.0.3.0 - Production
CORE 10.2.0.3.0 Production
TNS for 32-bit Windows: Version 10.2.0.3.0 - Production
NLSRTL Version 10.2.0.3.0 - Production
Elapsed: 00:00:00.04
satyaki>
satyaki>
satyaki>create table email_master
2 (
3 email_grp_header varchar2(30) not null,
4 craete_time timestamp,
5 constraints pk_header primary key(email_grp_header)
6 );
Table created.
Elapsed: 00:00:02.12
satyaki>
satyaki>create table email_chld
2 (
3 email_grp_header varchar2(30) not null,
4 email_recepient varchar2(100),
5 craete_time timestamp,
6 constraint fk_header foreign key(email_grp_header) references email_master(email_grp_header)
7 );
Table created.
Elapsed: 00:00:00.09
satyaki>
satyaki>
satyaki>insert into email_master values('GRP_INVENTORY',systimestamp);
1 row created.
Elapsed: 00:00:00.07
satyaki>
satyaki>
satyaki>insert into email_master values('GRP_PURCHASE',systimestamp);
1 row created.
Elapsed: 00:00:00.03
satyaki>
satyaki>commit;
Commit complete.
Elapsed: 00:00:00.04
satyaki>
satyaki>select * from email_master;
EMAIL_GRP_HEADER CRAETE_TIME
GRP_INVENTORY 24-OCT-08 08.55.36.190000 PM
GRP_PURCHASE 24-OCT-08 08.55.54.481000 PM
Elapsed: 00:00:00.18
satyaki>
satyaki>
satyaki>insert into email_chld values('GRP_INVENTORY','[email protected]',systimestamp);
1 row created.
Elapsed: 00:00:00.07
satyaki>
satyaki>insert into email_chld values('GRP_INVENTORY','[email protected]',systimestamp);
1 row created.
Elapsed: 00:00:00.04
satyaki>
satyaki>insert into email_chld values('GRP_INVENTORY','[email protected]',systimestamp);
1 row created.
Elapsed: 00:00:00.03
satyaki>
satyaki>insert into email_chld values('GRP_PURCHASE','[email protected]',systimestamp);
1 row created.
Elapsed: 00:00:00.03
satyaki>
satyaki>insert into email_chld values('GRP_PURCHASE','[email protected]',systimestamp);
1 row created.
Elapsed: 00:00:00.11
satyaki>commit;
Commit complete.
Elapsed: 00:00:00.05
satyaki>
satyaki>select * from email_chld;
EMAIL_GRP_HEADER EMAIL_RECEPIENT CRAETE_TIME
GRP_INVENTORY [email protected] 24-OCT-08 08.56.46.107000 PM
GRP_INVENTORY [email protected] 24-OCT-08 08.57.03.551000 PM
GRP_INVENTORY [email protected] 24-OCT-08 08.57.36.277000 PM
GRP_PURCHASE [email protected] 24-OCT-08 08.58.06.129000 PM
GRP_PURCHASE [email protected] 24-OCT-08 08.58.26.900000 PM
Elapsed: 00:00:00.10
satyaki>And, then based on the group header you can get the list of recipient and use it dynamically inside your PL/SQL Application.
Regards.
Satyaki De. -
Need to send external email with attachment for workflow 20000075
Hello Everyone,
I am new to W/F, I Need to send external email with attachment for PO Release W/F 20000075. Currently Work item is being sent to SAP inbox of required user based on PO Release strategy configuration in SPRO. I tried to create Send mail step after PO release event but I am not sure how to arrive at Recipient type in send mail step(the mail should be sent to person in the release strategy). Everything looks fine all I need to do is to send external email with attachment instead of sending work item into SAP inbox.
Your help will be highly appreciated.
Thanks.You can use extended notifications to send an e-mail message with a link to the workitem. Search for extended notifications in SDN.
Regards,
Martin -
Symantec Mail Security with Exchange 2007 (Emails with Attachment missing)
HI, i need help here
I have Win 2008 with Exchange 2007 and Symantec Mail Security. Symantec was working fine until the license expired but it was still fine until yesterday, we realize that we cannot receive email with attachment. after stopping the symantec services, mail
flow went back to normal. We then remove the program from the control panel.
Then i found that i cant retrieve or find those emails that was sent to us during a period of ard 6 hours. i tried looking the the Symantec quarantine folder but it is not there.
Can someone point to me where should i look for the missing mails? When i do a mail flow troubleshoot i can see the logs that it is sent to the mailbox, but from users's outlook inbox, there is no email ??
Much AppreciatedSymantec's support group should be able to tell you what happened.
--- Rich Matheisen MCSE&I, Exchange MVP -
I love the shortcut command "New Email With Attachment." I seem to have lost the functionality to create an email directly using a file from finder and its no longer in the Keboard Shortcuts menu. I just refered to another mac not running on Mavricks and it is still there. Any one know how to retrieve this functionality?
Thanks.You can get this by creating a Service with Automator.
Open Automator (in Applications Folder) and Select Service.
1. Select: "Services receives selected [files or folders] in [Finder]"
2. Select the New Mail Message Action
Then Save, as: New Email with Attachment -
I have an iPhone 4 running 6.1 OS. Several times I have taken photos with my iPhone and then tried to email them from my iPhone to friends using Android Galaxy. They never receive the emails. When I select the photo to be emailed from "Camera Roll", several options appear (Mail, Message, Photo Stream, Twitter, Facebook etc). I select "Mail", then select an email address from my contact list, add some text to the message, select the size of photo and send. The email with attached photo is never received. Any idea why?
Well, your response about MMS is beyond my understanding unfortunately. Don't understand too well this issue of MMS and IMessage. I checked my settings and "Send as MMS" was OFF. I have turned it ON and tried to re-send the photos. No word yet if it was received.. Also, the "send and receive" addresses in the "Messages" setting only included my "@me" email address, and not my Yahoo address, which I am trying to add. It doesn't seem to be able to complete the verification process for that Yahoo address (it remains in a perpetual state of "verifying"), although it did add an "icloud" address, and my cell phone number. I have my "cellular data" turned OFF because I am in the States (I am Canadaian) and wish to restrict roaming charges. So are you saying that I cannot send photo attachments in emails from my iPhone, while connected to the in-house internet modem/router - ie., that I can do so only if my "cellular data" setting is ON? Then why do the messages still appear in the SENT folder? Do the settings on the recipient phone have an impact? It doesn't seem so because they were able to receive the messages from the PC/Hotmail source.
-
HOW TO SEND A HEBREW EMAIL WITH ATTACHMENT USING DEMO_MAIL
Hello All,
This is Not a question , just attaching something I've implemented and might be interesting for few of us,
This package I'm attaching allows to send Hebrew Language email + attaching files to it.
This package is based on demo_mail package (combined here but you can search at google for more example information if needed).
My Package is supplied as is , for any specific information regarding it , please contact me directly at : [email protected] or POST here.
* Please also note , that this package allow file to be attach via URL (meaning you will have to define a link to this file, if you would like to implement a link to a local file , e.g : c:\temp\myfile , you will have to customize the package your self with database directories option etc ...)
First I will attach an example of how to use it :
==================================
begin
demo_mail_heb.send_html_mail_attach(p_sender => '[email protected]',
p_recipients => '[email protected]',
p_subject => 'שלום וברכה עולם',
p_data => '<hr><b>בוקר טוב</b><hr>',
p_file_name => 'but_choose_file.gif',
p_file_mime_type => 'application/pdf',
p_file_URL => 'http://10.172.246.160:7777/i/but_choose_file.gif');
end;
Second Here is the Package (please note you will have to modify few settings in order to enable it , such as mail server address ..etc)
======================================================================================
CREATE OR REPLACE PACKAGE demo_mail_heb IS
----------------------- Customizable Section -----------------------
-- Customize the SMTP host, port and your domain name below.
smtp_host VARCHAR2(256) := 'mail.oracle.com';
smtp_port PLS_INTEGER := 25;
smtp_domain VARCHAR2(256) := 'oracle.com';
-- Customize the signature that will appear in the email's MIME header.
-- Useful for versioning.
MAILER_ID CONSTANT VARCHAR2(256) := 'Mailer by Oracle UTL_SMTP';
--------------------- End Customizable Section ---------------------
-- A unique string that demarcates boundaries of parts in a multi-part email
-- The string should not appear inside the body of any part of the email.
-- Customize this if needed or generate this randomly dynamically.
BOUNDARY CONSTANT VARCHAR2(256) := '-----7D81B75CCC90D2974F7A1CBD';
FIRST_BOUNDARY CONSTANT VARCHAR2(256) := '--' || BOUNDARY || utl_tcp.CRLF;
LAST_BOUNDARY CONSTANT VARCHAR2(256) := '--' || BOUNDARY || '--' ||
utl_tcp.CRLF;
-- A MIME type that denotes multi-part email (MIME) messages.
MULTIPART_MIME_TYPE CONSTANT VARCHAR2(256) := 'multipart/mixed; boundary="'||
BOUNDARY || '"';
MAX_BASE64_LINE_WIDTH CONSTANT PLS_INTEGER := 76 / 4 * 3;
-- Sent clear Html Email
procedure send_html_mail (p_sender in varchar2 default null,
p_recipients in varchar2 default null,
p_subject in varchar2 default null,
p_data in varchar2 default null,
p_mime_type in varchar2 default 'text/html; charset=windows-1255');
-- Sent Html Email with Attachment
procedure send_html_mail_attach (p_sender in varchar2 default null,
p_recipients in varchar2 default null,
p_subject in varchar2 default null,
p_data in varchar2 default '<b>áå÷ø èåá òåìí - áãé÷ä</b',
p_mime_type in varchar2 default demo_mail_heb.MULTIPART_MIME_TYPE,
p_file_name in varchar2 default 'but_choose_file.gif',
p_file_mime_type in varchar2 default 'application/pdf',
p_file_URL in varchar2 default 'http://10.172.246.160:7777/i/but_choose_file.gif');
-- A simple email API for sending email in plain text in a single call.
-- The format of an email address is one of these:
-- someone@some-domain
-- "Someone at some domain" <someone@some-domain>
-- Someone at some domain <someone@some-domain>
-- The recipients is a list of email addresses separated by
-- either a "," or a ";"
PROCEDURE mail(sender IN VARCHAR2,
recipients IN VARCHAR2,
subject IN VARCHAR2,
message IN VARCHAR2);
-- Extended email API to send email in HTML or plain text with no size limit.
-- First, begin the email by begin_mail(). Then, call write_text() repeatedly
-- to send email in ASCII piece-by-piece. Or, call write_mb_text() to send
-- email in non-ASCII or multi-byte character set. End the email with
-- end_mail().
FUNCTION begin_mail(sender IN VARCHAR2,
recipients IN VARCHAR2,
subject IN VARCHAR2,
mime_type IN VARCHAR2 DEFAULT 'text/plain',
priority IN PLS_INTEGER DEFAULT NULL)
RETURN utl_smtp.connection;
-- Write email body in ASCII
PROCEDURE write_text(conn IN OUT NOCOPY utl_smtp.connection,
message IN VARCHAR2);
-- Write email body in non-ASCII (including multi-byte). The email body
-- will be sent in the database character set.
PROCEDURE write_mb_text(conn IN OUT NOCOPY utl_smtp.connection,
message IN VARCHAR2);
-- Write email body in binary
PROCEDURE write_raw(conn IN OUT NOCOPY utl_smtp.connection,
message IN RAW);
-- APIs to send email with attachments. Attachments are sent by sending
-- emails in "multipart/mixed" MIME format. Specify that MIME format when
-- beginning an email with begin_mail().
-- Send a single text attachment.
PROCEDURE attach_text(conn IN OUT NOCOPY utl_smtp.connection,
data IN VARCHAR2,
mime_type IN VARCHAR2 DEFAULT 'text/plain',
inline IN BOOLEAN DEFAULT TRUE,
filename IN VARCHAR2 DEFAULT NULL,
last IN BOOLEAN DEFAULT FALSE);
-- Send a binary attachment. The attachment will be encoded in Base-64
-- encoding format.
PROCEDURE attach_base64(conn IN OUT NOCOPY utl_smtp.connection,
data IN RAW,
mime_type IN VARCHAR2 DEFAULT 'application/octet',
inline IN BOOLEAN DEFAULT TRUE,
filename IN VARCHAR2 DEFAULT NULL,
last IN BOOLEAN DEFAULT FALSE);
-- Send an attachment with no size limit. First, begin the attachment
-- with begin_attachment(). Then, call write_text repeatedly to send
-- the attachment piece-by-piece. If the attachment is text-based but
-- in non-ASCII or multi-byte character set, use write_mb_text() instead.
-- To send binary attachment, the binary content should first be
-- encoded in Base-64 encoding format using the demo package for 8i,
-- or the native one in 9i. End the attachment with end_attachment.
PROCEDURE begin_attachment(conn IN OUT NOCOPY utl_smtp.connection,
mime_type IN VARCHAR2 DEFAULT 'text/plain',
inline IN BOOLEAN DEFAULT TRUE,
filename IN VARCHAR2 DEFAULT NULL,
transfer_enc IN VARCHAR2 DEFAULT NULL);
-- End the attachment.
PROCEDURE end_attachment(conn IN OUT NOCOPY utl_smtp.connection,
last IN BOOLEAN DEFAULT FALSE);
-- End the email.
PROCEDURE end_mail(conn IN OUT NOCOPY utl_smtp.connection);
-- Extended email API to send multiple emails in a session for better
-- performance. First, begin an email session with begin_session.
-- Then, begin each email with a session by calling begin_mail_in_session
-- instead of begin_mail. End the email with end_mail_in_session instead
-- of end_mail. End the email session by end_session.
FUNCTION begin_session RETURN utl_smtp.connection;
-- Begin an email in a session.
PROCEDURE begin_mail_in_session(conn IN OUT NOCOPY utl_smtp.connection,
sender IN VARCHAR2,
recipients IN VARCHAR2,
subject IN VARCHAR2,
-- mime_type IN VARCHAR2 DEFAULT 'text/plain; charset=windows-1255',
mime_type IN VARCHAR2 DEFAULT 'text/plain',
priority IN PLS_INTEGER DEFAULT NULL);
-- End an email in a session.
PROCEDURE end_mail_in_session(conn IN OUT NOCOPY utl_smtp.connection);
-- End an email session.
PROCEDURE end_session(conn IN OUT NOCOPY utl_smtp.connection);
END;
CREATE OR REPLACE PACKAGE BODY demo_mail_heb IS
-- Sent clear Html Email
procedure send_html_mail (p_sender in varchar2 default null,
p_recipients in varchar2 default null,
p_subject in varchar2 default null,
p_data in varchar2 default null,
p_mime_type in varchar2 default 'text/html; charset=windows-1255')
Is
conn utl_smtp.connection;
BEGIN
conn := demo_mail_heb.begin_mail(
sender => p_sender,
recipients => p_recipients,
subject => p_subject,
mime_type => p_mime_type);
demo_mail_heb.write_text(
conn => conn,
message => p_data);
demo_mail_heb.end_mail( conn => conn );
END;
-- Sent Html Email with Attachment
procedure send_html_mail_attach (p_sender in varchar2 default null,
p_recipients in varchar2 default null,
p_subject in varchar2 default null,
p_data in varchar2 default '<b>áå÷ø èåá òåìí - áãé÷ä</b',
p_mime_type in varchar2 default demo_mail_heb.MULTIPART_MIME_TYPE,
p_file_name in varchar2 default 'but_choose_file.gif',
p_file_mime_type in varchar2 default 'application/pdf',
p_file_URL in varchar2 default 'http://10.172.246.160:7777/i/but_choose_file.gif')
is
conn utl_smtp.connection;
req utl_http.req;
resp utl_http.resp;
data RAW(200);
begin
conn := demo_mail_heb.begin_mail(
sender => p_sender,
recipients => p_recipients,
subject => p_subject,
mime_type => p_mime_type);
demo_mail_heb.attach_text(
conn => conn,
data => p_data,
mime_type => 'text/html');
demo_mail_heb.begin_attachment(
conn => conn,
mime_type => p_file_mime_type,
inline => TRUE,
filename => p_file_name,
transfer_enc => 'base64');
-- In writing Base-64 encoded text following the MIME format below,
-- the MIME format requires that a long piece of data must be splitted
-- into multiple lines and each line of encoded data cannot exceed
-- 80 characters, including the new-line characters. Also, when
-- splitting the original data into pieces, the length of each chunk
-- of data before encoding must be a multiple of 3, except for the
-- last chunk. The constant demo_mail_heb.MAX_BASE64_LINE_WIDTH
-- (76 / 4 * 3 = 57) is the maximum length (in bytes) of each chunk
-- of data before encoding.
Utl_Http.set_proxy('www-proxy.us.oracle.com', 'oracle.com');
req := utl_http.begin_request(p_file_URL);
resp := utl_http.get_response(req);
BEGIN
LOOP
utl_http.read_raw(resp, data, demo_mail_heb.MAX_BASE64_LINE_WIDTH);
demo_mail_heb.write_raw(
conn => conn,
message => utl_encode.base64_encode(data));
END LOOP;
EXCEPTION
WHEN utl_http.end_of_body THEN
utl_http.end_response(resp);
END;
demo_mail_heb.end_attachment( conn => conn );
demo_mail_heb.end_mail( conn => conn );
end;
-- Return the next email address in the list of email addresses, separated
-- by either a "," or a ";". The format of mailbox may be in one of these:
-- someone@some-domain
-- "Someone at some domain" <someone@some-domain>
-- Someone at some domain <someone@some-domain>
FUNCTION get_address(addr_list IN OUT VARCHAR2) RETURN VARCHAR2 IS
addr VARCHAR2(256);
i pls_integer;
FUNCTION lookup_unquoted_char(str IN VARCHAR2,
chrs IN VARCHAR2) RETURN pls_integer AS
c VARCHAR2(5);
i pls_integer;
len pls_integer;
inside_quote BOOLEAN;
BEGIN
inside_quote := false;
i := 1;
len := length(str);
WHILE (i <= len) LOOP
c := substr(str, i, 1);
IF (inside_quote) THEN
IF (c = '"') THEN
inside_quote := false;
ELSIF (c = '\') THEN
i := i + 1; -- Skip the quote character
END IF;
GOTO next_char;
END IF;
IF (c = '"') THEN
inside_quote := true;
GOTO next_char;
END IF;
IF (instr(chrs, c) >= 1) THEN
RETURN i;
END IF;
<<next_char>>
i := i + 1;
END LOOP;
RETURN 0;
END;
BEGIN
addr_list := ltrim(addr_list);
i := lookup_unquoted_char(addr_list, ',;');
IF (i >= 1) THEN
addr := substr(addr_list, 1, i - 1);
addr_list := substr(addr_list, i + 1);
ELSE
addr := addr_list;
addr_list := '';
END IF;
i := lookup_unquoted_char(addr, '<');
IF (i >= 1) THEN
addr := substr(addr, i + 1);
i := instr(addr, '>');
IF (i >= 1) THEN
addr := substr(addr, 1, i - 1);
END IF;
END IF;
RETURN addr;
END;
-- Write a MIME header
PROCEDURE write_mime_header(conn IN OUT NOCOPY utl_smtp.connection,
name IN VARCHAR2,
value IN VARCHAR2) IS
BEGIN
-- utl_smtp.write_data(conn, name || ': ' || value || utl_tcp.CRLF);
utl_smtp.write_raw_data(conn, UTL_RAW.CAST_TO_RAW(name || ': ' ||value || utl_tcp.CRLF));
END;
-- Mark a message-part boundary. Set <last> to TRUE for the last boundary.
PROCEDURE write_boundary(conn IN OUT NOCOPY utl_smtp.connection,
last IN BOOLEAN DEFAULT FALSE) AS
BEGIN
IF (last) THEN
utl_smtp.write_data(conn, LAST_BOUNDARY);
ELSE
utl_smtp.write_data(conn, FIRST_BOUNDARY);
END IF;
END;
PROCEDURE mail(sender IN VARCHAR2,
recipients IN VARCHAR2,
subject IN VARCHAR2,
message IN VARCHAR2) IS
conn utl_smtp.connection;
BEGIN
conn := begin_mail(sender, recipients, subject);
write_text(conn, message);
end_mail(conn);
END;
FUNCTION begin_mail(sender IN VARCHAR2,
recipients IN VARCHAR2,
subject IN VARCHAR2,
mime_type IN VARCHAR2 DEFAULT 'text/plain',
priority IN PLS_INTEGER DEFAULT NULL)
RETURN utl_smtp.connection IS
conn utl_smtp.connection;
BEGIN
conn := begin_session;
begin_mail_in_session(conn, sender, recipients, subject, mime_type,
priority);
RETURN conn;
END;
PROCEDURE write_text(conn IN OUT NOCOPY utl_smtp.connection,
message IN VARCHAR2) IS
BEGIN
utl_smtp.write_raw_data(conn, utl_raw.cast_to_raw(CONVERT(message,'IW8ISO8859P8')));
END;
PROCEDURE write_mb_text(conn IN OUT NOCOPY utl_smtp.connection,
message IN VARCHAR2) IS
BEGIN
utl_smtp.write_raw_data(conn, utl_raw.cast_to_raw(message));
END;
PROCEDURE write_raw(conn IN OUT NOCOPY utl_smtp.connection,
message IN RAW) IS
BEGIN
utl_smtp.write_raw_data(conn, message);
END;
PROCEDURE attach_text(conn IN OUT NOCOPY utl_smtp.connection,
data IN VARCHAR2,
mime_type IN VARCHAR2 DEFAULT 'text/plain',
inline IN BOOLEAN DEFAULT TRUE,
filename IN VARCHAR2 DEFAULT NULL,
last IN BOOLEAN DEFAULT FALSE) IS
BEGIN
begin_attachment(conn, mime_type, inline, filename);
write_text(conn, data);
end_attachment(conn, last);
END;
PROCEDURE attach_base64(conn IN OUT NOCOPY utl_smtp.connection,
data IN RAW,
mime_type IN VARCHAR2 DEFAULT 'application/octet',
inline IN BOOLEAN DEFAULT TRUE,
filename IN VARCHAR2 DEFAULT NULL,
last IN BOOLEAN DEFAULT FALSE) IS
i PLS_INTEGER;
len PLS_INTEGER;
BEGIN
begin_attachment(conn, mime_type, inline, filename, 'base64');
-- Split the Base64-encoded attachment into multiple lines
i := 1;
len := utl_raw.length(data);
WHILE (i < len) LOOP
IF (i + MAX_BASE64_LINE_WIDTH < len) THEN
utl_smtp.write_raw_data(conn,
utl_encode.base64_encode(utl_raw.substr(data, i,
MAX_BASE64_LINE_WIDTH)));
ELSE
utl_smtp.write_raw_data(conn,
utl_encode.base64_encode(utl_raw.substr(data, i)));
END IF;
utl_smtp.write_data(conn, utl_tcp.CRLF);
i := i + MAX_BASE64_LINE_WIDTH;
END LOOP;
end_attachment(conn, last);
END;
PROCEDURE begin_attachment(conn IN OUT NOCOPY utl_smtp.connection,
mime_type IN VARCHAR2 DEFAULT 'text/plain',
inline IN BOOLEAN DEFAULT TRUE,
filename IN VARCHAR2 DEFAULT NULL,
transfer_enc IN VARCHAR2 DEFAULT NULL) IS
BEGIN
write_boundary(conn);
write_mime_header(conn, 'Content-Type', mime_type);
IF (filename IS NOT NULL) THEN
IF (inline) THEN
write_mime_header(conn, 'Content-Disposition',
'inline; filename="'||filename||'"');
ELSE
write_mime_header(conn, 'Content-Disposition',
'attachment; filename="'||filename||'"');
END IF;
END IF;
IF (transfer_enc IS NOT NULL) THEN
write_mime_header(conn, 'Content-Transfer-Encoding', transfer_enc);
END IF;
utl_smtp.write_data(conn, utl_tcp.CRLF);
END;
PROCEDURE end_attachment(conn IN OUT NOCOPY utl_smtp.connection,
last IN BOOLEAN DEFAULT FALSE) IS
BEGIN
utl_smtp.write_data(conn, utl_tcp.CRLF);
IF (last) THEN
write_boundary(conn, last);
END IF;
END;
PROCEDURE end_mail(conn IN OUT NOCOPY utl_smtp.connection) IS
BEGIN
end_mail_in_session(conn);
end_session(conn);
END;
FUNCTION begin_session RETURN utl_smtp.connection IS
conn utl_smtp.connection;
BEGIN
-- open SMTP connection
conn := utl_smtp.open_connection(smtp_host, smtp_port);
utl_smtp.helo(conn, smtp_domain);
RETURN conn;
END;
PROCEDURE begin_mail_in_session(conn IN OUT NOCOPY utl_smtp.connection,
sender IN VARCHAR2,
recipients IN VARCHAR2,
subject IN VARCHAR2,
mime_type IN VARCHAR2 DEFAULT 'text/plain',
-- mime_type IN VARCHAR2 DEFAULT 'text/plain; charset=windows-1255',
priority IN PLS_INTEGER DEFAULT NULL) IS
my_recipients VARCHAR2(32767) := recipients;
my_sender VARCHAR2(32767) := sender;
BEGIN
-- Specify sender's address (our server allows bogus address
-- as long as it is a full email address ([email protected]).
utl_smtp.mail(conn, get_address(my_sender));
-- Specify recipient(s) of the email.
WHILE (my_recipients IS NOT NULL) LOOP
utl_smtp.rcpt(conn, get_address(my_recipients));
END LOOP;
-- Start body of email
utl_smtp.open_data(conn);
-- Set "From" MIME header
write_mime_header(conn, 'From', sender);
-- Set "To" MIME header
write_mime_header(conn, 'To', recipients);
-- Set "Subject" MIME header
write_mime_header(conn, 'Subject', subject);
-- Set "Content-Type" MIME header
write_mime_header(conn, 'Content-Type', mime_type);
-- Set "X-Mailer" MIME header
write_mime_header(conn, 'X-Mailer', MAILER_ID);
-- Set priority:
-- High Normal Low
-- 1 2 3 4 5
IF (priority IS NOT NULL) THEN
write_mime_header(conn, 'X-Priority', priority);
END IF;
-- Send an empty line to denotes end of MIME headers and
-- beginning of message body.
utl_smtp.write_data(conn, utl_tcp.CRLF);
IF (mime_type LIKE 'multipart/mixed%') THEN
write_text(conn, 'This is a multi-part message in MIME format.' ||
utl_tcp.crlf);
END IF;
END;
PROCEDURE end_mail_in_session(conn IN OUT NOCOPY utl_smtp.connection) IS
BEGIN
utl_smtp.close_data(conn);
END;
PROCEDURE end_session(conn IN OUT NOCOPY utl_smtp.connection) IS
BEGIN
utl_smtp.quit(conn);
END;
END;Hello All,
Small modification - use this package and not the above
HERE IS A WORKING CODE FOR SENDING HEBREW MESSAGES (INCLUDING SUBJECT IN UTF-8 APPEAR IN ALL EMAIL CLIENTS I HAVE CHECKED) + ATTACHMENTS
Code attached below is supplied as is with no support. anyhow if help is needed , please contact me via [email protected]
============================================================================
CREATE OR REPLACE PACKAGE demo_mail_heb IS
----------------------- Customizable Section -----------------------
-- Customize the SMTP host, port and your domain name below.
smtp_host VARCHAR2(256) := pst_ajax.getParameter('EMAIL_SMTP_HOST');
smtp_port PLS_INTEGER := pst_ajax.getParameter('EMAIL_SMTP_PORT');
smtp_domain VARCHAR2(256) := pst_ajax.getParameter('EMAIL_SMTP_DOMAIN');
-- Customize the signature that will appear in the email's MIME header.
-- Useful for versioning.
MAILER_ID CONSTANT VARCHAR2(256) := 'Mailer by Oracle UTL_SMTP';
--------------------- End Customizable Section ---------------------
-- A unique string that demarcates boundaries of parts in a multi-part email
-- The string should not appear inside the body of any part of the email.
-- Customize this if needed or generate this randomly dynamically.
BOUNDARY CONSTANT VARCHAR2(256) := '-----7D81B75CCC90D2974F7A1CBD';
FIRST_BOUNDARY CONSTANT VARCHAR2(256) := '--' || BOUNDARY || utl_tcp.CRLF;
LAST_BOUNDARY CONSTANT VARCHAR2(256) := '--' || BOUNDARY || '--' ||
utl_tcp.CRLF;
-- A MIME type that denotes multi-part email (MIME) messages.
MULTIPART_MIME_TYPE CONSTANT VARCHAR2(256) := 'multipart/mixed; boundary="'||
BOUNDARY || '"';
MAX_BASE64_LINE_WIDTH CONSTANT PLS_INTEGER := 76 / 4 * 3;
-- Sent clear Html Email
procedure send_html_mail (p_sender in varchar2 default null,
p_recipients in varchar2 default null,
p_subject in varchar2 default null,
p_data in varchar2 default null,
p_mime_type in varchar2 default 'text/html; charset=windows-1255');
-- Sent Html Email with Attachment
procedure send_html_mail_attach (p_sender in varchar2 default null,
p_recipients in varchar2 default null,
p_subject in varchar2 default null,
p_data in varchar2 default '<b>áå÷ø èåá òåìí - áãé÷ä</b',
p_mime_type in varchar2 default 'text/html; charset=windows-1255',
p_file_name in varchar2 default 'but_choose_file.gif',
p_file_mime_type in varchar2 default 'application/pdf',
p_file_URL in varchar2 default 'http://10.172.246.160:7777/i/but_choose_file.gif');
-- A simple email API for sending email in plain text in a single call.
-- The format of an email address is one of these:
-- someone@some-domain
-- "Someone at some domain" <someone@some-domain>
-- Someone at some domain <someone@some-domain>
-- The recipients is a list of email addresses separated by
-- either a "," or a ";"
PROCEDURE mail(sender IN VARCHAR2,
recipients IN VARCHAR2,
subject IN VARCHAR2,
message IN VARCHAR2);
-- Extended email API to send email in HTML or plain text with no size limit.
-- First, begin the email by begin_mail(). Then, call write_text() repeatedly
-- to send email in ASCII piece-by-piece. Or, call write_mb_text() to send
-- email in non-ASCII or multi-byte character set. End the email with
-- end_mail().
FUNCTION begin_mail(sender IN VARCHAR2,
recipients IN VARCHAR2,
subject IN VARCHAR2,
mime_type IN VARCHAR2 DEFAULT 'text/plain',
priority IN PLS_INTEGER DEFAULT NULL)
RETURN utl_smtp.connection;
-- Write email body in ASCII
PROCEDURE write_text(conn IN OUT NOCOPY utl_smtp.connection,
message IN VARCHAR2);
-- Write email body in non-ASCII (including multi-byte). The email body
-- will be sent in the database character set.
PROCEDURE write_mb_text(conn IN OUT NOCOPY utl_smtp.connection,
message IN VARCHAR2);
-- Write email body in binary
PROCEDURE write_raw(conn IN OUT NOCOPY utl_smtp.connection,
message IN RAW);
-- APIs to send email with attachments. Attachments are sent by sending
-- emails in "multipart/mixed" MIME format. Specify that MIME format when
-- beginning an email with begin_mail().
-- Send a single text attachment.
PROCEDURE attach_text(conn IN OUT NOCOPY utl_smtp.connection,
data IN VARCHAR2,
mime_type IN VARCHAR2 DEFAULT 'text/plain',
inline IN BOOLEAN DEFAULT TRUE,
filename IN VARCHAR2 DEFAULT NULL,
last IN BOOLEAN DEFAULT FALSE);
-- Send a binary attachment. The attachment will be encoded in Base-64
-- encoding format.
PROCEDURE attach_base64(conn IN OUT NOCOPY utl_smtp.connection,
data IN RAW,
mime_type IN VARCHAR2 DEFAULT 'application/octet',
inline IN BOOLEAN DEFAULT TRUE,
filename IN VARCHAR2 DEFAULT NULL,
last IN BOOLEAN DEFAULT FALSE);
-- Send an attachment with no size limit. First, begin the attachment
-- with begin_attachment(). Then, call write_text repeatedly to send
-- the attachment piece-by-piece. If the attachment is text-based but
-- in non-ASCII or multi-byte character set, use write_mb_text() instead.
-- To send binary attachment, the binary content should first be
-- encoded in Base-64 encoding format using the demo package for 8i,
-- or the native one in 9i. End the attachment with end_attachment.
PROCEDURE begin_attachment(conn IN OUT NOCOPY utl_smtp.connection,
mime_type IN VARCHAR2 DEFAULT 'text/plain',
inline IN BOOLEAN DEFAULT TRUE,
filename IN VARCHAR2 DEFAULT NULL,
transfer_enc IN VARCHAR2 DEFAULT NULL);
-- End the attachment.
PROCEDURE end_attachment(conn IN OUT NOCOPY utl_smtp.connection,
last IN BOOLEAN DEFAULT FALSE);
-- End the email.
PROCEDURE end_mail(conn IN OUT NOCOPY utl_smtp.connection);
-- Extended email API to send multiple emails in a session for better
-- performance. First, begin an email session with begin_session.
-- Then, begin each email with a session by calling begin_mail_in_session
-- instead of begin_mail. End the email with end_mail_in_session instead
-- of end_mail. End the email session by end_session.
FUNCTION begin_session RETURN utl_smtp.connection;
-- Handling the Email Subject Line
function mimeheader_encode(
p_str varchar2
, p_charset varchar2 := 'UTF-8') return varchar2;
-- Begin an email in a session.
PROCEDURE begin_mail_in_session(conn IN OUT NOCOPY utl_smtp.connection,
sender IN VARCHAR2,
recipients IN VARCHAR2,
subject IN VARCHAR2,
-- mime_type IN VARCHAR2 DEFAULT 'text/plain; charset=windows-1255',
mime_type IN VARCHAR2 DEFAULT 'text/plain',
priority IN PLS_INTEGER DEFAULT NULL);
-- End an email in a session.
PROCEDURE end_mail_in_session(conn IN OUT NOCOPY utl_smtp.connection);
-- End an email session.
PROCEDURE end_session(conn IN OUT NOCOPY utl_smtp.connection);
END;
CREATE OR REPLACE PACKAGE BODY demo_mail_heb IS
-- Sent clear Html Email
procedure send_html_mail (p_sender in varchar2 default null,
p_recipients in varchar2 default null,
p_subject in varchar2 default null,
p_data in varchar2 default null,
p_mime_type in varchar2 default 'text/html; charset=windows-1255')
Is
conn utl_smtp.connection;
BEGIN
conn := demo_mail_heb.begin_mail(
sender => p_sender,
recipients => p_recipients,
subject => p_subject,
mime_type => 'text/html; charset=UTF-8');--p_mime_type);
demo_mail_heb.write_text(
conn => conn,
message => p_data);
demo_mail_heb.end_mail( conn => conn );
END;
-- Sent Html Email with Attachment
procedure send_html_mail_attach (p_sender in varchar2 default null,
p_recipients in varchar2 default null,
p_subject in varchar2 default null,
p_data in varchar2 default '<b>áå÷ø èåá òåìí - áãé÷ä</b',
p_mime_type in varchar2 default 'text/html; charset=windows-1255',
p_file_name in varchar2 default 'but_choose_file.gif',
p_file_mime_type in varchar2 default 'application/pdf',
p_file_URL in varchar2 default 'http://10.172.246.160:7777/i/but_choose_file.gif')
is
conn utl_smtp.connection;
req utl_http.req;
resp utl_http.resp;
data RAW(200);
v_mime_type varchar2(32767):=demo_mail.MULTIPART_MIME_TYPE;
begin
conn := demo_mail_heb.begin_mail(
sender => p_sender,
recipients => p_recipients,
subject => p_subject,
mime_type => v_mime_type);
demo_mail_heb.attach_text(
conn => conn,
data => p_data,
mime_type => 'text/html');
demo_mail_heb.begin_attachment(
conn => conn,
mime_type => p_file_mime_type,
inline => TRUE,
filename => p_file_name,
transfer_enc => 'base64');
-- In writing Base-64 encoded text following the MIME format below,
-- the MIME format requires that a long piece of data must be splitted
-- into multiple lines and each line of encoded data cannot exceed
-- 80 characters, including the new-line characters. Also, when
-- splitting the original data into pieces, the length of each chunk
-- of data before encoding must be a multiple of 3, except for the
-- last chunk. The constant demo_mail_heb.MAX_BASE64_LINE_WIDTH
-- (76 / 4 * 3 = 57) is the maximum length (in bytes) of each chunk
-- of data before encoding.
req := utl_http.begin_request(p_file_URL);
resp := utl_http.get_response(req);
BEGIN
LOOP
utl_http.read_raw(resp, data, demo_mail_heb.MAX_BASE64_LINE_WIDTH);
demo_mail_heb.write_raw(
conn => conn,
message => utl_encode.base64_encode(data));
END LOOP;
EXCEPTION
WHEN utl_http.end_of_body THEN
utl_http.end_response(resp);
END;
demo_mail_heb.end_attachment( conn => conn );
demo_mail_heb.end_mail( conn => conn );
end;
-- Return the next email address in the list of email addresses, separated
-- by either a "," or a ";". The format of mailbox may be in one of these:
-- someone@some-domain
-- "Someone at some domain" <someone@some-domain>
-- Someone at some domain <someone@some-domain>
FUNCTION get_address(addr_list IN OUT VARCHAR2) RETURN VARCHAR2 IS
addr VARCHAR2(256);
i pls_integer;
FUNCTION lookup_unquoted_char(str IN VARCHAR2,
chrs IN VARCHAR2) RETURN pls_integer AS
c VARCHAR2(5);
i pls_integer;
len pls_integer;
inside_quote BOOLEAN;
BEGIN
inside_quote := false;
i := 1;
len := length(str);
WHILE (i <= len) LOOP
c := substr(str, i, 1);
IF (inside_quote) THEN
IF (c = '"') THEN
inside_quote := false;
ELSIF (c = '\') THEN
i := i + 1; -- Skip the quote character
END IF;
GOTO next_char;
END IF;
IF (c = '"') THEN
inside_quote := true;
GOTO next_char;
END IF;
IF (instr(chrs, c) >= 1) THEN
RETURN i;
END IF;
<<next_char>>
i := i + 1;
END LOOP;
RETURN 0;
END;
BEGIN
addr_list := ltrim(addr_list);
i := lookup_unquoted_char(addr_list, ',;');
IF (i >= 1) THEN
addr := substr(addr_list, 1, i - 1);
addr_list := substr(addr_list, i + 1);
ELSE
addr := addr_list;
addr_list := '';
END IF;
i := lookup_unquoted_char(addr, '<');
IF (i >= 1) THEN
addr := substr(addr, i + 1);
i := instr(addr, '>');
IF (i >= 1) THEN
addr := substr(addr, 1, i - 1);
END IF;
END IF;
RETURN addr;
END;
-- Write a MIME header
PROCEDURE write_mime_header(conn IN OUT NOCOPY utl_smtp.connection,
name IN VARCHAR2,
value IN VARCHAR2) IS
BEGIN
-- utl_smtp.write_data(conn, name || ': ' || value || utl_tcp.CRLF);
utl_smtp.write_raw_data(conn, UTL_RAW.CAST_TO_RAW(name || ': ' ||value || utl_tcp.CRLF));
END;
-- Mark a message-part boundary. Set <last> to TRUE for the last boundary.
PROCEDURE write_boundary(conn IN OUT NOCOPY utl_smtp.connection,
last IN BOOLEAN DEFAULT FALSE) AS
BEGIN
IF (last) THEN
utl_smtp.write_data(conn, LAST_BOUNDARY);
ELSE
utl_smtp.write_data(conn, FIRST_BOUNDARY);
END IF;
END;
PROCEDURE mail(sender IN VARCHAR2,
recipients IN VARCHAR2,
subject IN VARCHAR2,
message IN VARCHAR2) IS
conn utl_smtp.connection;
BEGIN
conn := begin_mail(sender, recipients, subject);
write_text(conn, message);
end_mail(conn);
END;
FUNCTION begin_mail(sender IN VARCHAR2,
recipients IN VARCHAR2,
subject IN VARCHAR2,
mime_type IN VARCHAR2 DEFAULT 'text/plain',
priority IN PLS_INTEGER DEFAULT NULL)
RETURN utl_smtp.connection IS
conn utl_smtp.connection;
BEGIN
conn := begin_session;
begin_mail_in_session(conn, sender, recipients, subject, mime_type,
priority);
RETURN conn;
END;
PROCEDURE write_text(conn IN OUT NOCOPY utl_smtp.connection,
message IN VARCHAR2) IS
BEGIN
utl_smtp.write_raw_data(conn, utl_raw.cast_to_raw(CONVERT(message,'IW8ISO8859P8')));
-- utl_smtp.write_raw_data(conn, utl_raw.cast_to_raw(message));
END;
PROCEDURE write_mb_text(conn IN OUT NOCOPY utl_smtp.connection,
message IN VARCHAR2) IS
BEGIN
utl_smtp.write_raw_data(conn, utl_raw.cast_to_raw(message));
END;
PROCEDURE write_raw(conn IN OUT NOCOPY utl_smtp.connection,
message IN RAW) IS
BEGIN
utl_smtp.write_raw_data(conn, message);
END;
PROCEDURE attach_text(conn IN OUT NOCOPY utl_smtp.connection,
data IN VARCHAR2,
mime_type IN VARCHAR2 DEFAULT 'text/plain',
inline IN BOOLEAN DEFAULT TRUE,
filename IN VARCHAR2 DEFAULT NULL,
last IN BOOLEAN DEFAULT FALSE) IS
BEGIN
begin_attachment(conn, mime_type, inline, filename);
write_text(conn, data);
end_attachment(conn, last);
END;
PROCEDURE attach_base64(conn IN OUT NOCOPY utl_smtp.connection,
data IN RAW,
mime_type IN VARCHAR2 DEFAULT 'application/octet',
inline IN BOOLEAN DEFAULT TRUE,
filename IN VARCHAR2 DEFAULT NULL,
last IN BOOLEAN DEFAULT FALSE) IS
i PLS_INTEGER;
len PLS_INTEGER;
BEGIN
begin_attachment(conn, mime_type, inline, filename, 'base64');
-- Split the Base64-encoded attachment into multiple lines
i := 1;
len := utl_raw.length(data);
WHILE (i < len) LOOP
IF (i + MAX_BASE64_LINE_WIDTH < len) THEN
utl_smtp.write_raw_data(conn,
utl_encode.base64_encode(utl_raw.substr(data, i,
MAX_BASE64_LINE_WIDTH)));
ELSE
utl_smtp.write_raw_data(conn,
utl_encode.base64_encode(utl_raw.substr(data, i)));
END IF;
utl_smtp.write_data(conn, utl_tcp.CRLF);
i := i + MAX_BASE64_LINE_WIDTH;
END LOOP;
end_attachment(conn, last);
END;
PROCEDURE begin_attachment(conn IN OUT NOCOPY utl_smtp.connection,
mime_type IN VARCHAR2 DEFAULT 'text/plain',
inline IN BOOLEAN DEFAULT TRUE,
filename IN VARCHAR2 DEFAULT NULL,
transfer_enc IN VARCHAR2 DEFAULT NULL) IS
BEGIN
write_boundary(conn);
write_mime_header(conn, 'Content-Type', mime_type);
IF (filename IS NOT NULL) THEN
IF (inline) THEN
write_mime_header(conn, 'Content-Disposition',
'inline; filename="'||filename||'"');
ELSE
write_mime_header(conn, 'Content-Disposition',
'attachment; filename="'||filename||'"');
END IF;
END IF;
IF (transfer_enc IS NOT NULL) THEN
write_mime_header(conn, 'Content-Transfer-Encoding', transfer_enc);
END IF;
utl_smtp.write_data(conn, utl_tcp.CRLF);
END;
PROCEDURE end_attachment(conn IN OUT NOCOPY utl_smtp.connection,
last IN BOOLEAN DEFAULT FALSE) IS
BEGIN
utl_smtp.write_data(conn, utl_tcp.CRLF);
IF (last) THEN
write_boundary(conn, last);
END IF;
END;
PROCEDURE end_mail(conn IN OUT NOCOPY utl_smtp.connection) IS
BEGIN
end_mail_in_session(conn);
end_session(conn);
END;
FUNCTION begin_session RETURN utl_smtp.connection IS
conn utl_smtp.connection;
BEGIN
-- open SMTP connection
conn := utl_smtp.open_connection(smtp_host, smtp_port);
utl_smtp.helo(conn, smtp_domain);
RETURN conn;
END;
-- Handling the Email Subject Line
function mimeheader_encode(
p_str varchar2
, p_charset varchar2 := 'UTF-8') return varchar2 is
l_str varchar2(2000);
begin
l_str:=utl_raw.cast_to_varchar2(utl_encode.quoted_printable_encode(utl_raw.cast_to_raw(p_str)));
l_str:=replace(l_str,'='||chr(13)||chr(10),''); --unfold the data
l_str:=replace(l_str,'?','=3f'); --quote question marks
l_str:=replace(l_str,' ','=20'); --quote spaces
l_str:='=?'||p_charset||'?Q?'||l_str||'?='; -- add prefix and suffix
return l_str;
end;
PROCEDURE begin_mail_in_session(conn IN OUT NOCOPY utl_smtp.connection,
sender IN VARCHAR2,
recipients IN VARCHAR2,
subject IN VARCHAR2,
mime_type IN VARCHAR2 DEFAULT 'text/plain',
-- mime_type IN VARCHAR2 DEFAULT 'text/plain; charset=windows-1255',
priority IN PLS_INTEGER DEFAULT NULL) IS
my_recipients VARCHAR2(32767) := recipients;
my_sender VARCHAR2(32767) := sender;
BEGIN
-- Specify sender's address (our server allows bogus address
-- as long as it is a full email address ([email protected]).
utl_smtp.mail(conn, get_address(my_sender));
-- Specify recipient(s) of the email.
WHILE (my_recipients IS NOT NULL) LOOP
utl_smtp.rcpt(conn, get_address(my_recipients));
END LOOP;
-- Start body of email
utl_smtp.open_data(conn);
-- Set "From" MIME header
write_mime_header(conn, 'From', sender);
-- Set "To" MIME header
write_mime_header(conn, 'To', recipients);
-- Set "Content-Type" MIME header
write_mime_header(conn, 'Content-Type', mime_type);
-- write_mime_header(conn, 'Content-Type', 'text/html; charset=UTF-8');
-- Set "Subject" MIME header
-- write_mime_header(conn, 'Subject', subject);
-- write_mime_header(conn, 'Subject', CONVERT(subject,'IW8ISO8859P8'));
write_mime_header(conn, 'Subject',mimeheader_encode(p_str => subject,p_charset => 'UTF-8'));
-- write_mime_header(conn, 'Subject',CONVERT(subject,'IW8MSWIN1255'));
-- Set "X-Mailer" MIME header
write_mime_header(conn, 'X-Mailer', MAILER_ID);
-- Set priority:
-- High Normal Low
-- 1 2 3 4 5
IF (priority IS NOT NULL) THEN
write_mime_header(conn, 'X-Priority', priority);
END IF;
-- Send an empty line to denotes end of MIME headers and
-- beginning of message body.
utl_smtp.write_data(conn, utl_tcp.CRLF);
IF (mime_type LIKE 'multipart/mixed%') THEN
write_text(conn, 'This is a multi-part message in MIME format.' ||
utl_tcp.crlf);
END IF;
END;
PROCEDURE end_mail_in_session(conn IN OUT NOCOPY utl_smtp.connection) IS
BEGIN
utl_smtp.close_data(conn);
END;
PROCEDURE end_session(conn IN OUT NOCOPY utl_smtp.connection) IS
BEGIN
utl_smtp.quit(conn);
END;
END; -
Can we have more than one attachement to the "Email with Attachment" activity
Guys,
I have a requirement in which the process has n number of approvers in the flow, and each approver can add attachments to the form in the list<document> variable which carries the attahced documents.
At the end of the process i am supposed to send a email with all the attached files to a help desk team.
I know that the Email with attachment activity supports one attachment. is there any posibility or other activity that i can use to send an email with any number of attachments?Hi Ashok
The service you want is called "Send with Map of Attachments". This service is not on the toolbar.
If you drag on the Define Activity step and type "email" in the Find box you will see under Foundation that there are 3 email services.
Choose Send with Map of Attachments.
For help on this service see: http://help.adobe.com/en_US/livecycle/9.0/workbenchHelp/help.htm?content=000570.html
Diana -
XI Mail Adapter: sending emails with attachment with help of java mapping
Hi ,
On trying out the scenerio mentioned in the blog, using the java mapping provided
"XI Mail Adapter: An approach for sending emails with attachment with help of Java mapping
The scenerio works just fine.
But the payload as the content of the attachment is not getting generated in proper XML format.
I suppose it's because of the replace special characters code part..
Can anyone help me state the modification required in the code.
Thanks!
Regards,
Faria MithaniIt might be a codepage issue. Is your original payload UTF-8?
-
Send email with attachment via XI
Hi,
I need some help regarding sending out email with attchment via XI. My scenario will be I will need to send an email with attachment of Purchase Order (PDF format). I need to do it via XI. Is there any best way for me to configure my SENDER/RECEIVER Mail Adapter in order to send the email with PDF attachment via XI.
Appreciate any valuable thoughts and advice.
Thanks,
ZubairHave you seen these blogs
https://weblogs.sdn.sap.com/pub/wlg/1685 [original link is broken] [original link is broken] [original link is broken] [original link is broken] [original link is broken] [original link is broken] [original link is broken] [original link is broken] [original link is broken]
/people/prasad.ulagappan2/blog/2005/06/07/mail-adapter-scenarios-150-sap-exchange-infrastructure
regards
SKM -
How to send email with attachment
Hi friends,
I am using soa 11.1.1.7.0
Jdev 11.1.1.7.0
WebLogic:- 10.3
I want to generated email with attachment in BPEL 11g. Below is what i did in my bpel process
Create simple hello world bpel process.
In email activity below details are given
<scope name="Email1">
<bpelx:annotation>
<bpelx:pattern patternName="bpelx:email"></bpelx:pattern>
</bpelx:annotation>
<variables>
<variable name="varNotificationReq"
messageType="ns1:EmailNotificationRequest"/>
<variable name="varNotificationResponse"
messageType="ns1:ArrayOfResponse"/>
<variable name="NotificationServiceFaultVariable"
messageType="ns1:NotificationServiceErrorMessage"/>
</variables>
<sequence name="Sequence1">
<assign name="EmailParamsAssign">
<copy>
<from expression="string('Default')"/>
<to variable="varNotificationReq" part="EmailPayload"
query="/EmailPayload/ns1:FromAccountName"/>
</copy>
<copy>
<from expression="string('')"/>
<to variable="varNotificationReq" part="EmailPayload"
query="/EmailPayload/ns1:FromUserName"/>
</copy>
<copy>
<from expression="string('')"/>
<to variable="varNotificationReq" part="EmailPayload"
query="/EmailPayload/ns1:Bcc"/>
</copy>
<copy>
<from expression="string('')"/>
<to variable="varNotificationReq" part="EmailPayload"
query="/EmailPayload/ns1:Cc"/>
</copy>
<copy>
<from expression="string('')"/>
<to variable="varNotificationReq" part="EmailPayload"
query="/EmailPayload/ns1:ReplyToAddress"/>
</copy>
<copy>
<from expression="bpws:getVariableData('inputVariable','payload','/client:process/client:subject')"/>
<to variable="varNotificationReq" part="EmailPayload"
query="/EmailPayload/ns1:Subject"/>
</copy>
<copy>
<from expression="bpws:getVariableData('inputVariable','payload','/client:process/client:to')"/>
<to variable="varNotificationReq" part="EmailPayload"
query="/EmailPayload/ns1:To"/>
</copy>
<copy>
<from><Content xmlns="http://xmlns.oracle.com/ias/pcbpel/NotificationService"><MimeType xmlns="http://xmlns.oracle.com/ias/pcbpel/NotificationService">multipart/mixed</MimeType><ContentBody xmlns="http://xmlns.oracle.com/ias/pcbpel/NotificationService"><MultiPart xmlns="http://xmlns.oracle.com/ias/pcbpel/NotificationService"> <BodyPart xmlns="http://xmlns.oracle.com/ias/pcbpel/NotificationService"><MimeType xmlns="http://xmlns.oracle.com/ias/pcbpel/NotificationService"/><ContentBody xmlns="http://xmlns.oracle.com/ias/pcbpel/NotificationService"/><BodyPartName xmlns="http://xmlns.oracle.com/ias/pcbpel/NotificationService"/></BodyPart> <BodyPart xmlns="http://xmlns.oracle.com/ias/pcbpel/NotificationService"><MimeType xmlns="http://xmlns.oracle.com/ias/pcbpel/NotificationService"/><ContentBody xmlns="http://xmlns.oracle.com/ias/pcbpel/NotificationService"/><BodyPartName xmlns="http://xmlns.oracle.com/ias/pcbpel/NotificationService"/></BodyPart></MultiPart></ContentBody></Content></from>
<to variable="varNotificationReq" part="EmailPayload"
query="/EmailPayload/ns1:Content"/>
</copy>
<copy>
<from expression="string('text/html; charset=UTF-8')"/>
<to variable="varNotificationReq" part="EmailPayload"
query="/EmailPayload/ns1:Content/ns1:ContentBody/ns1:MultiPart/ns1:BodyPart[1]/ns1:MimeType"/>
</copy>
<copy>
<from expression="bpws:getVariableData('inputVariable','payload','/client:process/client:body')"/>
<to variable="varNotificationReq" part="EmailPayload"
query="/EmailPayload/ns1:Content/ns1:ContentBody/ns1:MultiPart/ns1:BodyPart[1]/ns1:ContentBody"/>
</copy>
<copy>
<from expression="string('text/plain')"/>
<to variable="varNotificationReq" part="EmailPayload"
query="/EmailPayload/ns1:Content/ns1:ContentBody/ns1:MultiPart/ns1:BodyPart[2]/ns1:MimeType"/>
</copy>
<copy>
<from expression="string('SampleStudent.txt')"/>
<to variable="varNotificationReq" part="EmailPayload"
query="/EmailPayload/ns1:Content/ns1:ContentBody/ns1:MultiPart/ns1:BodyPart[2]/ns1:BodyPartName"/>
</copy>
<copy>
<from expression="concat('file:///', bpws:getVariableData('inputVariable','payload','/client:process/client:attachmentURI'))"/>
<to variable="varNotificationReq" part="EmailPayload"
query="/EmailPayload/ns1:Content/ns1:ContentBody/ns1:MultiPart/ns1:BodyPart[2]/ns1:ContentBody"/>
</copy>
</assign>
<invoke name="InvokeNotificationService"
portType="ns1:NotificationService"
partnerLink="NotificationService1"
inputVariable="varNotificationReq"
outputVariable="varNotificationResponse"
operation="sendEmailNotification"/>
</sequence>
</scope>
<!--
Asynchronous callback to the requester. (Note: the callback location and correlation id is transparently handled using WS-addressing.)
-->
<invoke name="callbackClient"
partnerLink="sendingemailwithattachmentsprcs_client"
portType="client:SendingEmailWithAttachmentsPrcsCallback"
operation="processResponse" inputVariable="outputVariable"/>
</sequence>
</process>
I am able to generate Email with attachment but i cant see the data in the attached file.
I think i need to convert the data before sending as a attachment. Could someone please help me in generating the txt files.
Regards,
Rajireddy.Re: sending fax
Maybe you are looking for
-
I get my Office 365 account set up and working in Thunderbird. I can download and send mail just fine using the auto-detect or manual account settings recommended by Microsoft/Outlook/Office 365. Everything appears to be working as it should as long
-
Email problems on Macbook.
My IPhone 5 has 4 email accounts set up on it, all of the accounts are receiving and sending emails fine. However when i go on my macbook and try to "get mail" it finds mail but does not show them in the inbox, i have tried changing a few settings on
-
Create a PDF with DDX that can be converted to PCL by generatePrintedOutput
Hi all, I have a scenario that puzzles me a bit. I have some forms that are Interactive forms (stored as XDP with the property Dynamic XML Form). I need to assemble these xdp-forms (and fill them with data) and add it all up in one PDF. This PDf shou
-
No Video on new Quicktiime install
Help!! I just installed Quicktime 7.2 on my G4 Desktop and when I try to play movies, I get the progress bar, the audio but no video. What happened, and how can I correct this? Ed
-
How to delete the starter app like youtube,stock etc from your ipod?
Hi i really want to know how to delete the youtube app from your ipod touch without using cydia. thanks.