Generating .ics file for adding reminders in Outlook
684612Jul 14 2009 — edited Sep 2 2009Hi,
I am developing a application. My requirement is to send a .ics file in the form of a link. I have gone through Dan's blog and was successfully able to send the mail.
But the mail that I receive is something like this:
MIME-Version: 1.0
Content-type: multipart/mixed; boundary="frontier"
frontier
Content-Type: text/vCalendar
charset="utf-8"
method=REQUEST
component=vevent
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//This is a generic ID//NONSGML ICAL_EVENT//EN
CALSCALE:GREGORIAN
METHOD:PUBLISH
BEGIN:VEVENT
DTSTART:13-JUL-0009 09.14 PM ASIA/TASHKENT
DTEND:13-JUL-0009 09.14 PM ASIA/TASHKENT
DTSTAMP:20090714T040710
UID:6EA6C3824BC9752BE040449808B572E4@companyname.com
STATUS:NEEDS-ACTION
END:VEVENT
END:VCALENDAR
frontier
Content-Type: text/html
charset="utf-8"
It doesnot have any link upon clicking which would open and add a reminder in Outlook.
This is the function that I am using:
CREATE OR REPLACE FUNCTION ical_event (
p_summary IN VARCHAR2
, p_organizer_name IN VARCHAR2
, p_organizer_email IN VARCHAR2
, p_start_date IN VARCHAR2
, p_end_date IN VARCHAR2
, p_version IN VARCHAR2 := NULL
, p_prodid IN VARCHAR2 := NULL
, p_calscale IN VARCHAR2 := NULL
, p_method IN VARCHAR2 := NULL
)
RETURN VARCHAR2
AS
l_lf CHAR(2) := CHR(13)||CHR(10);
l_retval VARCHAR2(32767);
BEGIN
l_retval := ''
|| 'BEGIN:VCALENDAR' || l_lf
|| 'VERSION:' || NVL(p_version,'2.0') || l_lf
|| 'PRODID:' || NVL(p_prodid,'-//This is a generic ID//NONSGML ICAL_EVENT//EN') || l_lf
|| 'CALSCALE:' || NVL(p_calscale,'GREGORIAN') || l_lf
|| 'METHOD:' || NVL(p_method,'PUBLISH') || l_lf
|| 'BEGIN:VEVENT' || l_lf
|| 'DTSTART:' || TO_CHAR(TO_TIMESTAMP_TZ(p_start_date,'DD-MON-YYYY HH.MI.SS.FF AM TZR'),'DD-MON-YYYY HH.MI AM TZR') || l_lf
|| 'DTEND:' || TO_CHAR(TO_TIMESTAMP_TZ(p_end_date,'DD-MON-YYYY HH.MI.SS.FF AM TZR'),'DD-MON-YYYY HH.MI AM TZR') || l_lf
|| 'DTSTAMP:' || TO_CHAR(SYSDATE,'YYYYMMDD') || 'T' || TO_CHAR(SYSDATE,'HH24MISS') || l_lf
|| 'UID:' || RAWTOHEX(SYS_GUID()) || '@companyname.com' || l_lf
|| 'STATUS:NEEDS-ACTION' || l_lf
|| 'END:VEVENT' || l_lf
|| 'END:VCALENDAR';
RETURN l_retval;
END ical_event;
The procedure is
create or replace
PROCEDURE send_ical_email (
p_from IN VARCHAR2
, p_to IN VARCHAR2
, p_subj IN VARCHAR2
, p_body_html IN VARCHAR2
, p_body_ical IN VARCHAR2
)
AS
l_lf CHAR(1) := CHR(10);
l_msg_body VARCHAR2(32767);
BEGIN
l_msg_body := ''
|| 'Date: ' || TO_CHAR(SYSDATE,'DAY, DD-MON-RR HH24:MI') || l_lf
|| 'From: <' || p_from || '> ' || l_lf
|| 'Subject: ' || p_subj || l_lf
|| 'To: ' || p_to || l_lf
|| 'MIME-Version: 1.0' || l_lf
|| 'Content-type: multipart/mixed; boundary="frontier"' || l_lf
|| 'frontier' || l_lf
|| 'Content-Type: text/vCalendar' || l_lf
|| 'charset="utf-8"' || l_lf
|| 'method=REQUEST' || l_lf
|| 'component=vevent' || l_lf
|| l_lf
|| p_body_ical || l_lf
|| 'frontier' || l_lf
|| 'Content-Type: text/html' || l_lf
|| 'charset="utf-8"' || l_lf
|| l_lf
|| p_body_html || l_lf
|| 'frontier';
HTMLDB_MAIL.SEND(
P_TO => p_to,
P_FROM => p_from,
P_SUBJ => 'OWC',
P_BODY => l_msg_body);
htmldb_mail.push_queue( 'localhost', 25 );
HTMLDB_MAIL.SEND(
P_TO => p_from,
P_FROM => p_from,
P_SUBJ => 'OWC',
P_BODY => l_msg_body);
htmldb_mail.push_queue( 'localhost', 25 );
END send_ical_email;
Can anybody please help fulfill this requirement.
Regards,
Rinku Singh.