Function that would send email with body of select output
Hello support,
I want to create a function which would send an email of such type
BEGIN
flows_030100.wwv_flow_mail.send(
p_subj => 'test'
,p_body => I WANT A SELECT OUTPUT HERE :)))
,p_from => 'sender@mail'
,p_to => 'recepient@mail'
flows_030100.wwv_flow_mail.push_queue_background();
END;
I need a select output to be a body of an email.
Thank you in advance.
Hi,
In our WMS system we use the demo_mail package to send emails when we get system errors, you can write content to the body within a cursor or for i in (select ....) loop
conn utl_smtp.connection;
begin
conn := demo_mail.begin_mail(
sender => 'Helpdesk <[email protected]>',
recipients => V_Recipients,
subject => 'A WMS error has occurred!',
mime_type => demo_mail.MULTIPART_MIME_TYPE);
demo_mail.write_text(
conn => conn,
message => 'A system error has occurred at ' || I_Origin || ' while being operated by user ' || I_Username);
utl_smtp.write_data(conn, utl_tcp.CRLF);
utl_smtp.write_data(conn, utl_tcp.CRLF);
demo_mail.write_text(
conn => conn,
message => 'The error details are: ' || I_Notes);
for i in (SELECT STATEMENT HERE..) loop
demo_mail.write_text(
conn => conn,
message => i.field_name;
utl_smtp.write_data(conn, utl_tcp.CRLF);
end loop;
utl_smtp.write_data(conn, utl_tcp.CRLF);
demo_mail.write_text(
conn => conn,
message => V_Insert_Error);
demo_mail.end_mail( conn => conn );Hope this helps.
Graham.
Similar Messages
-
Send email with body in a specific template
Hello
I want to send an email from an ABAP program with the message body in a specified template with borders. Is it possible to do this?? I had used class BCS in one of my previous program in which the message body was in text and it worked. Can my current requirement be met with class BCS.
Can anyone please help me
Regards
SatharHi,
Here is an example to give you an idea. In the html file saved in the webrepository (tcode SMW0) you placed placeholders like !reden!.
regards,
Bert
form DO_SEND_MAIL changing LV_SEND type XFELD.
data: TEXTLINE type SOLI.
data: SMTPADR type AD_SMTPADR,
SEND_REQUEST type ref to CL_BCS,
TEXT type BCSY_TEXT,
DOCUMENT type ref to CL_DOCUMENT_BCS,
SENDER type ref to CL_SAPUSER_BCS,
RECIPIENT type ref to IF_RECIPIENT_BCS,
SENT_TO_ALL type BOOLEAN.
data: LT_TEXT type table of SOLI.
data: LT_MAIL type table of SOLI.
data: LW_MAIL type SOLI.
data: LV_SUBJECT type SO_OBJ_DES.
data: LV_HEADER type SO_OBJ_DES.
data: LS_VBAK type VBAK.
data: LS_KUAGV type KUAGV.
data: LS_KURGV type KURGV.
data: LS_KUWEV type KUWEV.
data: LV_DATUM type STRING.
data: LV_PLANNERDESCR type DSNAM.
data: LV_PROJECTVERANT_DESCR type PS_VERNA.
data: LV_NWP_DESCR type AUFTEXT.
data: LW_PROJ type PROJ.
data: LV_VALUE3 type CHAR255.
data: LV_VALUE2 type CHAR255.
data: LS_APPOBJECT type BORIDENT.
type-pools: SWWW.
data: LV_TEMPLATE type W3OBJID.
data: LT_H type table of W3HTML.
data: LW_H type W3HTML.
data: LT_M type SWWW_T_MERGE_TABLE.
data: LW_M type SWWW_T_MERGE_ITEM.
if GS_DATA-EMAIL1 is initial and GS_DATA-EMAIL2 is initial.
message 'Geen emailadressen opgegeven, Mail verzenden mislukt' type 'S'.
else.
* voorbereidende acties
* actie 1: Mail onderwerp instellen
if GS_DATA-STATUS = '900'.
concatenate 'Aanvraag is afgewezen:' GS_DATA-XBLNR into LV_SUBJECT separated by SPACE.
else.
concatenate 'Projectplandata aanvraag:' GS_DATA-XBLNR into LV_SUBJECT separated by SPACE.
endif.
* actie 2: Aanhef(header) instellen
call function 'SD_SALES_DOCUMENT_READ'
exporting
DOCUMENT_NUMBER = GS_DATA-VBELN
I_BLOCK = ''
I_NO_AUTHORITY_CHECK = 'X'
importing
EKUAGV = LS_KUAGV
EKURGV = LS_KURGV
EKUWEV = LS_KUWEV
EVBAK = LS_VBAK.
concatenate 'Beste' LS_KUAGV-NAME1 into LV_HEADER separated by SPACE.
* actie 3
* create persistent send request
SEND_REQUEST = CL_BCS=>CREATE_PERSISTENT( ).
* html template uit web repository halen !! zie SMW0
if GS_DATA-STATUS = '900'.
refresh LT_H.
clear: LW_H, LW_M.
LV_TEMPLATE = 'ZMAIL_AANVRAAG_GEWEIGERD'.
LW_M-NAME = '!reden!'.
LW_M-COMMAND = 'R'.
LW_H-LINE = GS_DATA-STATUSTEXT.
append LW_H to LT_H.
append lines of LT_H to LW_M-HTML.
append LW_M to LT_M.
refresh LT_H.
clear: LW_H, LW_M.
LW_M-NAME = '!uwaanvraagnummer!'.
LW_M-COMMAND = 'R'.
LW_H-LINE = GS_DATA-XBLNR.
append LW_H to LT_H.
append lines of LT_H to LW_M-HTML.
append LW_M to LT_M.
refresh LT_H.
clear: LW_H, LW_M.
LV_TEMPLATE = 'ZMAIL_AANVRAAG_VERWERKT_KCO'.
call function 'WWW_HTML_MERGER'
exporting
TEMPLATE = LV_TEMPLATE
importing
HTML_TABLE = LT_H[]
changing
MERGE_TABLE = LT_M[].
loop at LT_H into LW_H.
LW_MAIL = LW_H.
append LW_MAIL to LT_MAIL.
endloop.
DOCUMENT = CL_DOCUMENT_BCS=>CREATE_DOCUMENT(
I_TYPE = 'HTM'
I_TEXT = LT_MAIL
I_SUBJECT = LV_SUBJECT ).
* add document to send request
call method SEND_REQUEST->SET_DOCUMENT( DOCUMENT ).
* --------- set sender -------------------------------------------
* note: this is necessary only if you want to set the sender
* different from actual user (SY-UNAME). Otherwise sender is
* set automatically with actual user.
SENDER = CL_SAPUSER_BCS=>CREATE( SY-UNAME ).
call method SEND_REQUEST->SET_SENDER
exporting
I_SENDER = SENDER.
* --------- add recipient (e-mail address) -----------------------
* create recipient
if GS_DATA-EMAIL1 is not initial.
SMTPADR = GS_DATA-EMAIL1.
RECIPIENT = CL_CAM_ADDRESS_BCS=>CREATE_INTERNET_ADDRESS( SMTPADR ).
* add recipient with its respective attributes to send request
call method SEND_REQUEST->ADD_RECIPIENT
exporting
I_RECIPIENT = RECIPIENT
I_EXPRESS = 'X'. "This message was sent with High Importance
endif.
if GS_DATA-AUGRU = 'Z02'.
if GS_DATA-EMAIL2 is not initial.
SMTPADR = GS_DATA-EMAIL2.
RECIPIENT = CL_CAM_ADDRESS_BCS=>CREATE_INTERNET_ADDRESS( SMTPADR ).
* add recipient with its respective attributes to send request
call method SEND_REQUEST->ADD_RECIPIENT
exporting
I_RECIPIENT = RECIPIENT
I_EXPRESS = 'X'. "This message was sent with High Importance
endif.
endif.
try.
move GS_DATA-VBELN to LS_APPOBJECT-OBJKEY.
move 'BUS2030' to LS_APPOBJECT-OBJTYPE.
call method SEND_REQUEST->CREATE_LINK
exporting
I_APPL_OBJECT = LS_APPOBJECT.
catch CX_SEND_REQ_BCS .
endtry.
* ---------- send document ---------------------------------------
call method SEND_REQUEST->SET_SEND_IMMEDIATELY
exporting
I_SEND_IMMEDIATELY = 'X'.
* Possible statuses in field I_REQUESTED_STATUS:
* N = No status is to be returned
* E = Only error statuses are to be returned
* A = Return all statuses
call method SEND_REQUEST->SEND(
exporting
I_WITH_ERROR_SCREEN = 'X'
receiving
RESULT = SENT_TO_ALL ).
if SENT_TO_ALL <> 'X'.
LV_SEND = SPACE.
else.
LV_SEND = 'X'.
commit work.
endif.
endif.
endform. " DO_SEND_MAIL -
Sending emails with both body and attachment to multiple recipients
I have a requirement to send email with body and attachment to multiple recipients.
Body of the email is a standard text. It is a proxy-to-mail scenario.
Here is what I've done: (I'm using PI 7.11)
One mapping from Source to Target structure (format of the attachment text file)
Second mapping from Target Structure to Mail Package format.
In the second mapping I'm concatenating the output of first step into "Content" of the Mail Package.
"XIPAYLOAD" is the message protocol used.
The "Keep attachments" option in the Mail adapter allows only to send "Content" as attachment or as body of the email.
How to send an email with both content and text?
The other problem is even with using ASMA, I can't send email to multiple recipients. I can only do CC and TO for 1 person each - a total of 2. Although I can resolve this by creating mailing lists, it is better if this can be addressed in PI.
Thanks for any input you can provide!
Edited by: crazylad on Jan 18, 2012 3:39 PMThank you for your response Mikael.
For the first question, I was able to find the solution in the following blog:
XI Mail Adapter : Dynamically building attachment and message body content using a simple UDF
(I just needed to search with the right set of key words )
The key is to set the "Content Encoding" as "None" in the mail adapter. If this is not done, the mail will be sent with an attachment - untitled.bin containing both the mail body and the attachment text. Also, don't forget to check the "Keep Attachments" checkbox in the mail adapter.
Multiple recipients could be added by separating the email IDs with a Comma. I have used ASMA to set the recipients. -
When I send emails with photos from iPhoto recipients often tell me images are upside down. What would cause that?
Found this :
https://discussions.apple.com/thread/3431867?start=0&tstart=0
by doing this :
http://www.google.com/search?q=images+are+upside+down+ios -
Reply address: is it possible to use another reply address other than the pop address used in my account. I have a special work account and would like to send emails with that address as my reply address...or sent from address
i found out how to do this finally!
1) set up google gmail account to forward your emails to (from the [email protected])
2) go to your gmail account
3) go to settings (cog in right hand corner)
4) go to 'accounts and import'
5) go to 'send mail as'
6) click 'Add another email address you own' - add your [email protected] address
7) google will send a verification email with code to that email address.
8) enter code
9) go back to gmail account >'send mail as' and select 'make default'
10) close mac 'mail' program and reopen it.
as long as you have gmail account selected as the primary account in MAIL - mail will now come throught as being sent from that [email protected] address!! -
Can I use DeliveryManager just to send email with no document?
Can I use "oracle.apps.xdo.delivery.DeliveryManager" to just send email without any document attached? or
Is this only used to deliver the documents by email?
I just want to use DeliveryManager just to send email with content in the body of the email. I am using BI Publisher API.
Can any of you provide sample input for the above?Hi,
You can use iMovie to record the message and save it as an email sized item and send the file as email like before.
For those iChat AV users without a Cam and the AIM users without a cam you can do One-Way Viedo chats.
Once you have a recorded Video file you can also drop the file on any Buddies name in you iChat Buddy list rather than using email.
For those using other services you can set up a Jabber account and enable the required Transport/Gateways and send the files that way.
http://www.jabber.org.au/ichat = Australian Page
AllForces
These are the two main information pages on how iChat can connect to the other IM services.
Jabber Public Server list
That would appear to be everybody.
Ralph -
How to send Email with attachments
Hi im Trying to send a file as attachment using EMail Activity operator.
Can we do it using Email activity? If yes, then how can we do it? If no, then please tell me about any other method using which i can send a email with attachments.
Regards
VibhutiBetter late than never, a comprehensive demo on the topic:
REM
REM maildemo.sql - A PL/SQL package to demonstrate how to use the UTL_SMTP
REM package to send emails in ASCII and non-ASCII character sets, emails
REM with text or binary attachments.
REM
REM Note: this package relies on the UTL_ENCODE PL/SQL package in Oracle 9i.
CREATE OR REPLACE PACKAGE demo_mail IS
----------------------- Customizable Section -----------------------
-- Customize the SMTP host, port and your domain name below.
smtp_host VARCHAR2(256) := 'smtp-server.some-company.com';
smtp_port PLS_INTEGER := 25;
smtp_domain VARCHAR2(256) := 'some-company.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;
-- 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',
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 IS
-- 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);
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_data(conn, 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;
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',
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;
/ -
Send Email with Attachment Callable Object
Hello,
I have a GP Application where i have 2 steps....in the first action the initiator attaches a document through standard GP functionality......i want to send this attachment to the approver alongwith the email i am already sending using 'Send email with Attachment (optional)' callable obejct.....how can i implement this....?
Any help would be highly appreciated.
Regards,
AnilHello Anil!
Well, if i really undestand your question, i think you resolve it using callable object mail with attachment, you said that do it, so, you only need to configure your smtp on youser server and you don´t need more work.
Please write any doubts. -
Is there any problem to use multiple threads to send email with JavaMail
Dear all,
I am using JavaMail 1.3.2 to send emails with SMTP, it works very well for a long time.
But one day, I found that the email service hanged and I could never send email again until I restart the tomcat. I found that the reason was a deadlock had been created, the required resource for sending email had not been released.
I guess the error is due to multiple threads are sending email at the same time. I made a test to create seperate thread for sending each email. After few days, I found this deadlock happened again. So, my question is: Can I use JavaMail with multiple threads? If not, I may need to sychronized all the thread that using JavaMail. I would like to make sure this is the reason for causing the deadlock problem.
Here is part of my code for using JavaMail:
transport = session.getTransport("smtp");
transport.connect(email_host, smtp_user, smtp_pass);
message.saveChanges();
transport.sendMessage(message,message.getAllRecipients());
which is very standard call, and it worked well for a long time.
Here is part for my thread dump on tomcat:
(Thread-339)
- waiting to lock <0x5447c180> (a sun.nio.cs.StandardCharsets)
(Thread-342)
- locked <0x5447c180> (a sun.nio.cs.StandardCharsets)
It seems that these happened after call the method transport.sendMessage() or message.updateChanges()
, and the underlying implementation may require the JRE StandardCharsets object. But the object had been locked and never be released. So, the sendMessage() or updateChanges() can't be completed.
Please give me some helps if you have any idea about it.
Thanks very much!
SiriusNote that the Nightly build gets updated daily (and sometimes more than once in case of a respin) and it is always possible that something goes wrong and it doesn't work properly, so be prepared for issues if you decide to stay with the Nightly build and make sure to have the current release with its own profile installed as well in case of problems.
See also:
* http://kb.mozillazine.org/Testing_pre-release_versions
*http://kb.mozillazine.org/Creating_a_new_Firefox_profile_on_Windows
*http://kb.mozillazine.org/Shortcut_to_a_specific_profile
*http://kb.mozillazine.org/Using_multiple_profiles_-_Firefox -
Is there anyway to print an ibook -
was told I could add a link to the ibook that would send the customer to my web site where they could print it?
I was told a customer could not print an ibook that they purchased?
Trying to figure out a way for them to purchase a book that they need to fill in information.
or download to their computers and print.
Any suggestions.... I have called and emailed - but can't get an answer
I have 5 books I would like to do this with.
<E-mail Edited by Host>BlueEyesinLA wrote:
Is there anyway to print an ibook -
Not as such. You would have to put a pdf version on your web site for download, which the reader would then have to print for himself. A pdf version might look rather different than the epub or .ibooks version, you would have to try that yourself to see how much. -
Sending email with multiple attachments
Hi forum,
I am able to send email with a single attachment using maildemo.sql from: http://www.oracle.com/technology/sample_code/tech/pl_sql/htdocs/Utl_Smtp_Sample.html
But now I am trying to send email with more than 1 attachment and it does not work. My code that calls the above mentioned package is as follows:
<code>
PROCEDURE send (
psender VARCHAR2,
precipients VARCHAR2,
pcc VARCHAR2,
pbcc VARCHAR2,
psubject VARCHAR2,
pmessage VARCHAR2,
pnumattach NUMBER) -- The number of attachments that need to be sent
IS
p_blob BLOB;
p_filename VARCHAR2(200);
p_filetype VARCHAR2(200);
p_currSeq NUMBER;
conn utl_smtp.CONNECTION;
i NUMBER;
j NUMBER;
len NUMBER;
BEGIN
IF pnumattach > 1
THEN
conn := SEND_EMAIL_HELPER.begin_mail(
sender => psender,
recipients => precipients,
subject => psubject,
mime_type => send_email_helper.MULTIPART_MIME_TYPE);
j := 0;
SELECT seq_attach_transact_id.CURRVAL INTO p_currSeq FROM dual; -- seq_attach_transact_id is a primary key that identifies every single attachment in the table
WHILE (j < pnumattach) LOOP
p_currSeq := p_currSeq - j;
SELECT blob_content INTO p_blob FROM wwdoc_document WHERE transaction_id = p_currSeq;
SELECT name INTO p_filename FROM wwdoc_document WHERE transaction_id = p_currSeq;
SELECT mime_type INTO p_filetype FROM wwdoc_document WHERE transaction_id = p_currSeq;
SEND_EMAIL_HELPER.begin_attachment(
conn => conn,
mime_type => p_filetype,
inline => TRUE,
filename => p_filename,
transfer_enc => 'base64');
-- split the Base64 encoded attachment into multiple lines
i := 1;
len := DBMS_LOB.getLength(p_blob);
WHILE (i < len) LOOP
IF(i + SEND_EMAIL_HELPER.MAX_BASE64_LINE_WIDTH < len)THEN
UTL_SMTP.Write_Raw_Data (conn,
UTL_ENCODE.Base64_Encode(
DBMS_LOB.SUBSTR(p_blob, SEND_EMAIL_HELPER.MAX_BASE64_LINE_WIDTH, i)));
ELSE
UTL_SMTP.Write_Raw_Data (conn,
UTL_ENCODE.Base64_Encode(
DBMS_LOB.SUBSTR(p_blob, (len - i)+1, i)));
END IF;
UTL_SMTP.Write_Data(conn, UTL_TCP.CRLF);
i := i + SEND_EMAIL_HELPER.MAX_BASE64_LINE_WIDTH;
END LOOP;
SEND_EMAIL_HELPER.end_attachment(conn => conn);
END LOOP;
SEND_EMAIL_HELPER.attach_text(
conn => conn,
data => pmessage,
mime_type => 'text/html');
SEND_EMAIL_HELPER.end_mail( conn => conn );
ELSE
utl_mail.send(psender,precipients,pcc,pbcc,psubject,pmessage);
END IF;
END send;
</code>
Can anyone please tell me where am i going wrong.
Message was edited by:
MonkThe easiest is to send an e-mail with multiple attachments to yourself and then view the message in raw to see how it is formatted - how the boundaries work. what the boundary headers are, etc.
Then you use that as a template for your PL/SQL code to generate a MIME body for an e-mail that has multiple attachments.
To debug.. have your PL/SQL code send sample e-mails with multiple attachment to your account, view it in raw format and compare that to the original format you've based your template on.
And none of this is really a PL/SQL issue.. it is all about formatting a valid MIME message for an e-mail. -
I'm trying to find out how to send emails with java - without using the java mail api - i've been told there is a way to do it but i cant seem to find it - any help on this would be gratefully recieved as i'm totally stuck! :(
Ok, I expanded on it a little bit. Still probably isnt totally correct.
String localhost="yourdomain.com";
String sendMailHost=�mail.domain.com�;
int portNo=25;
String from="[email protected]";
String to="[email protected]";
String message=�Message Body.�;
Socket s = new Socket(SendMailHost,portNo);
DataInputStream in = new DataInputStream(s.getInputStream() ) ;
PrintStream out = new PrintStream(s.getOutputStream() ) ;
out.println("HELO " + locahost);
out.flush() ;
in.readLine(); //ignore response
out.println("MAIL FROM: " + from);
out.flush() ;
in.readLine(); //ignore response
out.println("RCPT TO: " + to);
out.flush() ;
in.readLine(); //ignore response
out.println("DATA");
out.println(message);
out.println(�.�);
s.close(); -
Sending email with 1-2 MB attachment
Why sending email with small attachment in iPad IOS7 feels like waiting for a flight delay without announcement ?
Very embarrassing for Apple to missed this issue....
Internet connection is fine, but email could not get through the outbox.... Oh my God...Hey,
Many people have expirienced this...
The problem for most people were their, internet connection, or their device.
This might not work, for some people.
I would recommend holding down the power button and the home button until the apple logo shows up.
Then you can open mail and send your attachment, hopefully.
If that was successfull, have a good evening!
-- Shamurocks45 -
Function module for sending email
Hi all,
Can I know list of function modules for sending emails.
Other than "SO_DOCUMENT_SEND_API1"
pls let me knowHi Praveen,
Below is the sample code to send the external mail.
&**********Reward Points if helpful**********&
DATA: ld_mtitle LIKE sodocchgi1-obj_descr,
ld_format TYPE so_obj_tp ,
ld_attdescription TYPE so_obj_nam ,
ld_attfilename TYPE so_obj_des .
ld_receiver LIKE sy-subrc.
DATA: it_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
it_attachment LIKE solisti1 OCCURS 0 WITH HEADER LINE,
it_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
w_cnt TYPE i,
w_sent_all(1) TYPE c, "#EC NEEDED
w_doc_data LIKE sodocchgi1.
REFRESH it_receivers . CLEAR it_receivers .
IF v_trip_send = 'X'.
it_receivers-receiver = it_trip_dload-approver_email .
ELSE .
it_receivers-receiver = it_adv_dload-approver_email .
ENDIF.
it_receivers-rec_type = c_u .
APPEND it_receivers. CLEAR it_receivers.
it_receivers-receiver = " ------> pass your reciever email id.
IF v_trip_send = 'X' .
it_receivers-receiver = it_trip_dload-requester_email .
ELSE .
it_receivers-receiver = it_adv_dload-requester_email .
ENDIF .
it_receivers-rec_type = c_u .
it_receivers-copy = 'X' .
APPEND it_receivers. CLEAR it_receivers.
ld_mtitle = p_mtitle.
ld_format = p_format.
ld_attdescription = p_attdescription.
ld_attfilename = p_filename.
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 = c_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 = c_saprpt.
w_doc_data-obj_descr = ld_mtitle.
w_doc_data-sensitivty = c_f.
CLEAR it_attachment.
REFRESH it_attachment.
it_attachment[] = it_attach[].
Describe the body of the message
CLEAR it_packing_list.
REFRESH it_packing_list.
it_packing_list-transf_bin = space.
it_packing_list-head_start = 1.
it_packing_list-head_num = 0.
it_packing_list-body_start = 1.
DESCRIBE TABLE it_message LINES it_packing_list-body_num.
it_packing_list-doc_type = c_raw.
APPEND it_packing_list.
Create attachment notification
it_packing_list-transf_bin = c_x.
it_packing_list-head_start = 1.
it_packing_list-head_num = 1.
it_packing_list-body_start = 1.
DESCRIBE TABLE it_attachment LINES it_packing_list-body_num.
it_packing_list-doc_type = ld_format.
it_packing_list-obj_descr = ld_attdescription.
it_packing_list-obj_name = ld_attfilename.
it_packing_list-doc_size = it_packing_list-body_num * 255.
APPEND it_packing_list.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = w_doc_data
put_in_outbox = c_x
commit_work = c_x
IMPORTING
sent_to_all = w_sent_all
TABLES
packing_list = it_packing_list
contents_bin = it_attachment
contents_txt = it_message
receivers = it_receivers. -
Outlook 2010 wont send emails with attachments
Hello
I was starting to write the question when we found out what the problem was. So I thought I would share our resolution in here, in case someone fall in the same issue.
One of my user with Outlook 2010 cannot send emails with attachments of some size. +-50 kb files works fine.
But when we try a file of 1mb, the mail goes in the Outbox, Exchange status swith from Connected to Disconnected and the email stay there.
The user is in a remote location, connected through VPN with the network where the Exchange 2013 server is
Here is what I did:
1. Re-create Outlook profile: wont work
2. Re-create Windows profile: wont work
3. Check ip settings: fine
4. Try in OWA: wont work
5. Look at Exchange settings for outgoing email size: 10mb
6. Load my user's Outlook profile on another LAN: works fine
That last point made me thought about a potential problem on the remote user's lan. So I did
7. Check VPN config between the remote site and IT site: fine
After googling the problem, I found that website (http://community.spiceworks.com/topic/396793-outlook-2010-client-suddenly-showing-disconnected-from-2013-exchange-server) that suggest to change the DNS setting on the client. However, the DHCP of my remote
user was the router itself, which is giving a DC as primary DNS, and ISP DNS as secondary. I changed the secondary DNS for another DC in our organization, and guess what? Voila! Problem is gone!
Thinking about it that make not much sense, as the primary DNS is always up the secondary shouldn't be queried. But that's what resolved our problem.
Hope it helps someone!
MartinHi Martin,
Thanks for your sharing:)
If you have any question about Microsoft Office, welcome to contact us and feel free to post your issue on Office forum.
Regards,
Winnie Liang
TechNet Community Support
Maybe you are looking for
-
Hi there, does anyone know a (free or non-free) tool, plugin, extension or whatever to visualize ABAP Coding? What we would like to achieve with this: From a given starting point, create a diagram that shows which forms, functions, programs, ... are
-
Pay for Delete "PFD" While Making Payments?
I have a private student loan that went into default when it wasn't supposed to (that's a whole different story). But long story short, I am communicating with the loan holder (SunTrust) regarding a PFD for the defaulted loan. My goal is to pay the l
-
Can you link back to an iweb homepage from a .mac gallery?
Hi, I'm able to link from my iweb site to my .mac gallery, but how do I get back to my iweb site once I'm there? Can you put a link back from the .mac gallery to my iweb homepage? Thanks, Brian
-
Any OMNIS subscribers had success with iWeb '08?
I followed the instructions from iWeb and spoke to OMNIS and got instructions from them. I've successfully changed the DN to CNAME web.mac.com. I wasn't sure what information to put in the "Content" window. I've tried a few different things. I made t
-
STATUS of the LISTENER Alias LISTENER Version TNSLSNR for Linux: Version 8.1.5.0.0 - Production Start Date 14-SEP-99 19:06:21 Uptime 0 days 16 hr. 9 min. 20 sec Trace Level off Security OFF SNMP OFF !!!!!!!!!!! SNMP-Status is OFF. I am using Oracle 8