Need to send mail using apex
Hi,
I am using apex 4.2 and oracle 11g XE. I need to send mail so I used the following code:
HTMLDB_MAIL.SEND(
P_TO => '[email protected]',
P_FROM => [email protected]
P_SUBJ => 'Data in TECHNICAL_DETAIL edited' ,
P_BODY => 'Please click link below for affirmation/rejection of changes' ,
P_BODY_HTML=> '<p><a href="http://localhost:8080/apex/f?p=109:25:12079147455079">link</a></p>'
It is going t apex_mail_queue successfully. Then I used the following code:
which one i should use:
1.
wwv_flow_mail.push_queue(
P_SMTP_HOSTNAME => xxx
P_SMTP_PORTNO => 'yyy
or
2.
APEX_MAIL.PUSH_QUEUE(
P_SMTP_HOSTNAME => xxx
P_SMTP_PORTNO => yyy
Also what else I need to send mail and what should i ask DBA to provide me so that mail can be sent successfully.
Please give some idea.
Thanks,
Chandra Bhanu
Hi,
You should use APEX_MAIL.PUSH_QUEUE witch is documented
APEX_MAIL
Parameters
Description
p_smtp_hostname
SMTP gateway host name
p_smtp_portno
SMTP gateway port number
Note that these parameter values are provided for backward compatibility, but their respective values are ignored. The SMTP gateway hostname and SMTP gateway port number are exclusively derived from values entered on the Manage Environment Settings when sending email.
Regards,
Jari
Similar Messages
-
Sending Mails Using APEX 4.2
Hi All
I am in need to send emails using APEX 4.2. I have seen under page processing there is option called Send Email. But really not sure how to make use of it. My requirement is to trigger a mail on employee's birthday. Following is the screenshot.
Can anyone help me on this. Any reply would highly be appreciable.
Process Type
Process Attributes
Process
Messages
Process Conditions
Create Page Process - Process Type
Cancel
Next
Page:
3 - Edit AR Employees
Select the category of the process you wish to create:
Select the category of the process you wish to create:
PL/SQL
Reset Pagination
Plug-ins
Session State
Data Manipulation
Web Services
Form Pagination
Send E-Mail
Close popup window
Run On Demand ProcessHello,
First you need to write a procedure to send e-mails. Please find sample code below to send e-mail to manager, if employee birthday is today
CREATE OR REPLACE PROCEDURE pr_send_birthday_alerts
IS
BEGIN
/* if V_APP_USER is null, procedure is being executed as job
set security context */
IF v('APP_USER') IS NULL THEN
wwv_flow_api.set_security_group_id;
END IF;
-- Trigger mails if employee birthday is today
-- Send mail to Manager email address
/* Please change with actual table and column values */
FOR i IN (SELECT emp.name emp_name, manager.email manager_email, manager.name manager_name FROM t_employee emp, t_employee manager WHERE emp.manager_id = manager.emp_id AND TRUNC(emp.birth_date) = TRUNC(SYSDATE))
LOOP
/* Send mail */
/* Please change Subject and Body according to your need */
APEX_MAIL.SEND(
p_to => i.manager_email,
p_cc => NULL,
p_from => '[email protected]',
p_subj => 'Today is '||i.emp_name||' birthday',
p_body => NULL
END LOOP;
-- push all emails from queue
APEX_MAIL.PUSH_QUEUE;
END pr_send_birthday_alerts;
Next you need to schedule a job which will run above procedure everyday to Send Birthday alerts. Please find sample code below to schedule a procedure to run as Job.
BEGIN
/* Change Start date according to your requirement */
DBMS_SCHEDULER.CREATE_SCHEDULE (
schedule_name => 'sch_every_day',
start_date => TO_TIMESTAMP_TZ(TO_CHAR(SYSDATE,'YYYY-MM-DD')||' 06:00:00 +02:00','YYYY-MM-DD HH:MI:SS TZH:TZM'),
repeat_interval => 'FREQ=DAILY;'
DBMS_SCHEDULER.CREATE_JOB (
job_name => 'job_every_day',
schedule_name => 'sch_every_day',
job_type => 'STORED_PROCEDURE',
job_action => 'pr_send_birthday_alerts',
enabled => TRUE
COMMIT;
END;
So everyday in morning 6:00 A.M. GMT+ 2, system will check if any employee birthday is today and will send alert to his/her manager.
Please note that these code is not tested.
Regards,
Hari -
How to send mail using jsp program
am very new to jsp and doing my final year project. i need to send mails using my jsp program.can anyone say wht to do that is wht to include to send mails using jsp program. n also a sample code to send mail using jsp program.
Thanx in advanceUse below script.
<%@ page import="java.util.*, javax.mail.*, javax.mail.internet.*" %>
<%
Properties props = new Properties();
props.put("mail.smtp.host", "mailserver.com");
Session s = Session.getInstance(props,null);
InternetAddress from = new InternetAddress("[email protected]");
InternetAddress to = new InternetAddress([email protected]");
MimeMessage message = new MimeMessage(s);
message.setFrom(from);
message.addRecipient(Message.RecipientType.TO, to);
message.setSubject("Your subject");
message.setText("Your text");
Transport.send(message);
%>{code} -
Need to send a link in mail using apex
Hi,
I need to send a mail using apex which will contain a link for a specific page. For sending mail , I used the following query:
for c1 in (select EMAIL_ADDRESS
from USER_DETAILS
where USER_NAME= :P4_USER_NAME and EMAIL_ADDRESS=:P4_EMAIL_ADDRESS) loop
if c1.EMAIL_ADDRESS is not null then
HTMLDB_MAIL.SEND(
P_TO => c1.EMAIL_ADDRESS,
P_FROM => '[email protected]',
P_BODY => 'Your new password is '|| 'xyzxyz',
P_SUBJ => 'Password detail' );
end if;
end loop;
But how i will send the required link.
Pls give some idea.
Thanks,
Chandra BhanuHi Chandra,
Try this version of your code, you will alter the url to map to your apex server.
DECLARE
l_body VARCHAR2 (4000);
BEGIN
FOR c1
IN (SELECT email_address
FROM user_details
WHERE user_name = :p4_user_name
AND email_address = :p4_email_address)
LOOP
IF c1.email_address IS NOT NULL
THEN
-- Include link to login page
l_body :=
'<p>Your new password is '
|| 'xyzxyz'
|| ' To access the application and change your password, follow the '
|| 'link below.</p><p><a href="http://'
|| '</p><p><a href="http://edwprd:7777/pls/oitp/f?p=&APP_ID.:LOGIN</a></p>';
apex_mail.send (p_to => c1.email_address,
p_from => '[email protected]',
p_body => l_body,
p_subj => 'Password detail');
END IF;
END LOOP;
END;
Jeff -
Need to send mail & upload files using JSP
hi, got a lot of issues,.. just starting out as a developer.. so here goes.
1st Need to send mail & upload files to server using JSP(tomcat).. an example to demo it would be nice.
thanx in advanceLook at this for email:
http://forum.java.sun.com/thread.jspa?forumID=45&threadID=285950
and go to:
http://servlets.com/cos/
for a package to upload files. -
How to send mail in APEX 4.1 using PLSQL
Hi All,
How to send mail in APEX 4.1 using PLSQL?
Thanks In advance.
Regards
Shailhttp://lmgtfy.com/?q=oracle+apex+4.1+send+mail
-
Issue while sending mails using classes
Hi Experts ,
i have one issue when i try to send mails using classes cl_document_bcs,cl_cam_address_bcs,cl_bcs etc
ISSUE :
i put some data in selection screen and i get some output ( say i got 5 records), i select 3 records and press some button to trigger mail and mail is send, and now again the OUTPUT screen is shown with sended records but we can not send these records again ............ now i selcect remaining two records and press button to trigger mail and THIS TIME MAIL IS NOT SEND.
amd my code is :
CREATE OBJECT l_document.
CREATE OBJECT l_recipient.
TRY.
cl_bcs_convert=>string_to_solix(
EXPORTING
iv_string = fp_wa_output
iv_codepage = fp_v_code_page
iv_add_bom = 'X'
IMPORTING
et_solix = l_wa_output_binary
ev_size = l_v_size ).
l_send_request = cl_bcs=>create_persistent( ).
*-->Creating Document
l_document = cl_document_bcs=>create_document(
i_type = 'RAW'
i_text = fp_it_content[]
i_subject = fp_text_48 ) .
*-->Adding Attachment*
CALL METHOD l_document->add_attachment
EXPORTING
i_attachment_type = fp_text_049
i_attachment_size = l_v_size
i_attachment_subject = fp_v_file
i_att_content_hex = l_wa_output_binary.
*-->Add document to send request*
CALL METHOD l_send_request->set_document( l_document ).
* do send delivery info for successful mails
CALL METHOD l_send_request->set_status_attributes
EXPORTING
i_requested_status = 'E'
i_status_mail = 'A'.
*-->Get Sender Object
l_uname = sy-uname.
l_sender = cl_sapuser_bcs=>create( l_uname ).
CALL METHOD l_send_request->set_sender
EXPORTING
i_sender = l_sender.
LOOP AT fp_s_mail INTO l_wa_mail.
l_v_objid = l_wa_mail-low.
l_v_mail = l_v_smtpadr.
TRANSLATE l_v_mail TO LOWER CASE.
l_recipient = cl_cam_address_bcs=>create_internet_address( l_v_mail ).
CALL METHOD l_send_request->add_recipient
EXPORTING
i_recipient = l_recipient
i_express = 'X' .
* i_copy = ' '
* i_blind_copy = ' '
* i_no_forward = ' '.
ENDLOOP.
**-->Trigger E-Mail immediately*
* IF fp_send_all EQ 'X'.
* l_send_request->set_send_immediately( 'X' ).
* ENDIF.
CALL METHOD l_send_request->send(
EXPORTING
i_with_error_screen = 'X'
RECEIVING result = l_v_sent_to_all ).
BREAK TARK.
IF l_v_sent_to_all = 'X'.
MESSAGE i000 .
ENDIF.
COMMIT WORK.
CATCH cx_document_bcs INTO l_bcs_exception.
CATCH cx_send_req_bcs INTO l_send_exception.
CATCH cx_address_bcs INTO l_addr_exception.
CATCH cx_bcs INTO l_exp.
ENDTRY.
thanks in advance
rahulEvery time when i choose other network or dongle to send those mails it gets sent.
As per the description, seems it's an issue related to this specific network. Probably, they've adjusted their security policy, like blocked some port numbers, etc.
You might need to contact the support of your ISP to confirm what SMTP settings you need. Check port number, and security settings.
By the way, this is the forum to discuss questions and feedback for Windows-based Microsoft Office client. Since your query is directly related to
Office for mac, I would suggest you to post in the forum of
Office for Mac, where you can get more experienced responses:
http://answers.microsoft.com/en-us/mac/forum/macoffice2011?tab=Threads
The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.
Regards,
Ethan Hua
TechNet Community Support
It's recommended to download and install
Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
programs. -
Delivery Receipt After Sending Mail Using JavaMail ?
Hi Friends,
I have written an application using JavaMail which would be used to send mail
using my organisation's SMTP Server.I would like to include the following functionality in it.Just as
Microsoft's Outlook has an option to get Delivery Receipt of the mail and Read Receipt of the mail sent
(Provided the email Client supports it) i would like to have a similar option in my application to.I would like to of how i can do it using JavaMail.I heard that basically we need to set some SMTP properties which the Mail Transfer Agent would recognize and send us the Delivery and Read Receipts.But,i am not sure of what those properties.Can anyone help me regarding this ?You might look into creating a custom header that provides a return reciept to the email address you specify. I'm not 100% sure that all mail servers support this but you might want to look into it as a solution.
-Dave -
Sending mail from apex appliocation
Dear friends
Can anyone please tell me how to send mail from apex application to outside mail like gmail or yahoo
i have one report created which i want to send it to my mail from apex
Please hepl me....If it is an interactive report that you are try it on, you could probably use subscriptions to get the report to your email.
Thanks -
How to setup and send mails using utl_mail on Oracle E-Biz R12
Dear All
There is a new requirement from client to setup and send mails using utl_mail utility on Oracle EBS R12.1.1
What is utl_mail utility ? what is the difference between Workflow Notification Mailer and this utility/tool?
What are etiquette's to pursue mail functionality in apps / db?
- ChetanWhat is utl_mail utility
http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/u_mail.htm
How to Use the UTL_MAIL Package [ID 269375.1]
FAQ and Known Issues While Using UTL_SMTP and UTL_MAIL [ID 730746.1]
Master Note For PL/SQL UTL_SMTP and UTL_MAIL Packages [ID 1137673.1]
Workflow Notification Mailer:
you can send email using workflow notification email procedures,These ar built into the system and only need some minor configuration. check Workflow Administrator's Guide, Chapter 2, Section: Setting Up Notification Mailers for more detail. -
Can anyone help me how to send mails from apex to multiple users..
Thanks,
SriniHi Srini,
Have a look here: http://download.oracle.com/docs/cd/B31036_01/doc/appdev.22/b28550/api.htm#CHDDHBGI
You can use a comma between the mail addresses in the to and that should send the mails to multiple people.
Regards,
Dimitri
-- http://dgielis.blogspot.com/
-- http://www.apex-evangelists.com/
-- http://www.apexblogs.info/ -
HTML Tag problem when sending mails through APEX
Hi,
My code for sending mail is below:
DECLARE
l_body CLOB;
l_body_html CLOB;
cursor c2 is
SELECT pn,pdt_name FROM lib_details WHERE a_date BETWEEN to_date(:P13_SDATE,'DD-MON_YYYY') AND to_date(:P13_EDATE,'DD-MON-YYYY');
BEGIN
for c_lib in c2
loop
l_body_html:=l_body_html ||
'<html><body>
ul>
li>'||c_lib.pn||' , '||c_lib.pdt_name||' /li>
/ul>'; p;
l_body_html:=l_body_html ||'</body></html>';
apex_mail.send(
p_to => 'xxxx',
p_from => 'xxxx',
p_body => l_body_html,
p_subj => 'Test Mail');
END;
Gives me the output in the format below:
all the <html><body> tags also comes along with the email, though I get the correct output, what is the problem here?
I am not able to figure this out. Can someone help?
OUTPUT
<html><body>
ul> li>a,b
/ul><html><body>
ul> li>c,d
/ul><html><body>
PLEASE NOTE: I have intentionally removed the starting tags (<) of ul and li so that the post will not be formatted.
Edited by: Suzi on Feb 9, 2012 1:18 PM>
Gives me the output in the format below:
all the <html><body> tags also comes along with the email, though I get the correct output, what is the problem here?
I am not able to figure this out. Can someone help?For HTML output you need to send it using the <tt>p_body_html</tt> parameter, not <tt>p_body</tt>.
PLEASE NOTE: I have intentionally removed the starting tags (<) of ul and li so that the post will not be formatted.Posting code wrapped in <tt>\...\</tt> tags eliminates the need to resort to these bizarre circumlocutions. -
my i pad was purchased by my husband using his credit card but now when i send mails using icloud account to shows like is coming from him. how can i change his name to mine
MacBook Airs won't run Classic, nor will Classic connect to iCloud accounts. You will need your Mac OS X version to answer the question involved. Go to Apple menu -> About This Mac, and post in the appropriate forum in the link below:
https://discussions.apple.com/docs/DOC-2463 -
Hi. I have started using my iPhone 4S as a WiFi hotspot for my MBP when on the road. Mail collects from all my accounts ok but I cant send any mails from my MBP thru the Hotspot connection. I dont get any error message, just the spinning icon next to the sent mailbox and no info in the activity window. Any ideas welcome. thanks
Are you sending mail using a Broadband provider account?
For instance, Virgin Media Mail can only be send through the Virgin Media Sever when you are actually connected to your Virgin Media line (at home)
An attempt to send mail using the outgoiong server smtp.virgin.com will be blocked if it isn't coming down one of their own lines.
To cure it, you'll need to add a different smtp server to our mail account that can be used while youo're out an about. Normally this would be the smtp server that your phone company gives you i.e smtp.orange.co.uk or whatever. -
Problems to SEND MAIL using WWV_FLOW_MAIL.SEND - APEX_MAIL
I tried send mail using the code below
DECLARE
l_body CLOB:= EMPTY_CLOB;
l_body_html CLOB:= EMPTY_CLOB;
BEGIN
wwv_flow_api.set_security_group_id;
l_body :='<html>
+<head>+
+<style type="text/css">+
+body{font-family: Arial, Helvetica, sans-serif;+
+font-size:10pt;+
+margin:30px;+
+background-color:#ffffff;}+
+span.sig{font-style:italic;+
font-weight:bold;
color:#811919;}
+</style>+
+</head>+
+<body>+
+</html>';+
l_body_html := '<html>
+<head>+
+<style type="text/css">+
+body{font-family: Arial, Helvetica, sans-serif;+
+font-size:10pt;+
+margin:30px;+
+background-color:#ffffff;}+
+span.sig{font-style:italic;+
font-weight:bold;
color:#811919;}
+</style>+
+</head>+
+<body>+
+</html>';+
wwv_flow_mail.send('[email protected]','[email protected]',nvl(l_body,'Texto com erro'),nvl(l_body_html,'erro2'),'K','[email protected]',
+'[email protected]','[email protected]');+
wwv_flow_mail.push_queue;
END;
+/+
This code return the message:
Mail To From Subject CC BCC Created On Created By Error Created
CHECK$01 [email protected] [email protected] K [email protected] [email protected] 08/23/2010 03:05:00 PM SYS
ORA-06502: PL/SQL: erro: erro de conversão de caractere em número numérico ou de valor
Follow my mail settings
SMTP Host Address : POP.SLE.TERRA.COM.BR
SMTP Host Port 110
Administration Email Address [email protected]
Notification Email Address [email protected]
what´s wrong ?I would try sending just basic text first, then move on to getting your other pieces dynamics. The very last step to me would be the email body.
Here is an example of a basic text email I use:
declare
e_id NUMBER;
c_id NUMBER;
emp_nm VARCHAR2(100);
clrk_id NUMBER;
e_clrk VARCHAR2(47);
e_org NUMBER;
e_sender VARCHAR2(50);
e_recip_lst VARCHAR2(255);
e_cc VARCHAR2(100);
e_bcc VARCHAR2(100);
e_subj VARCHAR2(50);
e_msg_ln1 VARCHAR2(100);
e_msg_ln2 VARCHAR2(100);
e_msg_ln3 VARCHAR2(100);
e_msg_ln4 VARCHAR2(100);
e_msg_ln5 VARCHAR2(100);
e_msg VARCHAR2(1000);
CRLF CHAR(2) := CHR(13) || CHR(11);
tmp_flag NUMBER;
begin
if :P2_INJURY_FLAG = 1 then
-- find out if it has changed first so we don't keep sending emails
select injury_flag, VEH_LOC
into tmp_flag, e_org
from APPS.tc
where tc_id = :P2_TC_ID;
if :P2_injury_flag <> tmp_flag then
begin
select FN_GET_USER(nvl(v('APP_USER'),user))
into clrk_id
from dual;
select ADMIN_USERNAME
into e_clrk
from APPS.APEX_ACCESS_CONTROL
where ID = clrk_id;
exception
when others then null; -- in case we cannot find the user
end;
e_id := :P2_EMP_ID;
c_id := :P2_TC_ID;
select EMP_FNAME ||' '|| EMP_MNAME ||' '|| EMP_LNAME into emp_nm
from APPS.EMPLOYEES
where EMP_ID = e_id; --
select RECIPIENTS, CC, BCC
into e_recip_lst, e_cc, e_bcc
from APPS.SAFETY_NOTIFICATIONS
where ORG_ID = e_org; --
e_sender := '[email protected]';
e_subj := 'Loss Reported';
e_msg_ln1 := 'Employee: ' || emp_nm || ' (' || e_id || ')'
|| CRLF;
e_msg_ln2 := 'Was reported as sustaining a loss' || CRLF;
e_msg_ln3 := 'by ' || e_clrk ||CRLF;
e_msg_ln4 := CRLF;
e_msg_ln5 := 'Sent ' || to_char(sysdate,'MONTH DD,YYYY HH:MI AM');
e_msg := e_msg_ln1 || e_msg_ln2 || e_msg_ln3 || e_msg_ln4 || e_msg_ln5 || CRLF || e_recip_lst;
utl_mail.send(
sender => e_sender,
recipients => e_recip_lst,
cc => e_cc,
bcc => e_bcc,
subject => e_subj,
message => e_msg);
end if;
end if;
end;
Maybe you are looking for
-
How to Print two pages in smartforms
Hi All, How to create two different pages in smartforms.In my requirement the first page contains Table data in main window and in second page only the hard coded desription should be printed containg instructions,but the second page is mandatory aft
-
A pdf file will not display in a new window in FF12 (and many previous revisions)
There appear to be several different ways to display a pdf file from a browser. One is just opening another tab and displaying the file. This way works. Another option is a 'download' window will open up downloading the pdf file which can then be dis
-
Making a vector shape from a design
Hello all, I've been a very casual photoshop user for years, and know the basics of the program. However I'm a bit stumped with a current task. I recently had a friend do a single color shape-based logo design for my band. I love what he came up with
-
Please search the forums before posting - all points assigned have been unassigned Hi All, In migration from 3.5 to 7.0 what is role of BI consultant????? And what are the activities has to be done before & after while migration? All the answers are
-
Problems installing VM Server V2.1.5 on Intel i7-6Gb Ram
I am trying to install Oracle VM Server 2.1.5 on an Intel i-7 920 based server with 2x750Gb h/d and 6Gb RAM. It's looping on the Question: What type of media contains the packages to be installed?. Any choice I make results in the same question with