How to send email attachments in any format by utl_smtp?

Hi,
I am Using this Script for Sending Mail With an Attachment,i run this Script(Oracle 11g Database R1) and i got this Message "PL/SQL procedure successfully completed." but still i have not received the mail.
Please advice me....
set serveroutput on
/* Formatted on 2010/06/03 21:26 (Formatter Plus v4.8.8) */
DECLARE
v_file_handle UTL_FILE.file_type;
v_email_server VARCHAR2 (100) := 'Email_Server;
v_conn UTL_SMTP.connection;
v_port NUMBER := 25;
v_reply UTL_SMTP.reply;
v_msg VARCHAR2 (32767);
v_line VARCHAR2 (1000);
v_message VARCHAR2 (1000);
b_connected BOOLEAN := FALSE;
v_sender VARCHAR2 (50) := '************';
v_strt_day varchar2(100);
v_end_day varchar2(100);
crlf VARCHAR2 (2) := CHR (13) || CHR (10);
recpt VARCHAR2 (255) := '*********';
slp PLS_INTEGER := 300;
pdirpath VARCHAR2 (50) := 'D:\Mail_Process';
pfilename VARCHAR2 (50) := 'Multifile.html';
p_stat number     := 0;
BEGIN
/***** Check if the file exists ****/
BEGIN
v_file_handle := UTL_FILE.fopen (pdirpath, pfilename, 'R');
EXCEPTION
WHEN UTL_FILE.invalid_path
THEN
p_stat := 99;
RETURN;
WHEN OTHERS
THEN
p_stat := 99;
RETURN;
END;
/***** Try to connect for three times, do sleep in between for 5minutes *****/
FOR i IN 1 .. 3
LOOP
BEGIN
--open the connection with the smtp server and do the handshake
v_conn := UTL_SMTP.open_connection (v_email_server, v_port);
v_reply := UTL_SMTP.helo (v_conn, v_email_server);
IF 250 = v_reply.code
THEN
b_connected := TRUE;
EXIT;
END IF;
EXCEPTION
WHEN OTHERS
THEN
DBMS_LOCK.sleep (slp);
END;
END LOOP;
IF b_connected = FALSE
THEN
p_stat := 99;
RETURN;
END IF;
v_reply := UTL_SMTP.mail (v_conn, v_sender);
IF 250 != v_reply.code
THEN
p_stat := 99;
RETURN;
END IF;
v_reply := UTL_SMTP.rcpt (v_conn, recpt);
IF 250 != v_reply.code
THEN
p_stat := 99;
RETURN;
END IF;
UTL_SMTP.open_data (v_conn);
v_message :=
'Sample Email This is an auto generated mail.
Please do not reply to this mail.'
|| CHR (10);
v_msg :=
'Date: '
|| TO_CHAR (SYSDATE, 'Mon DD yy hh24:mi:ss')
|| crlf
|| 'From: '
|| v_sender
|| crlf
|| 'Subject: '
|| 'Sample file'
|| crlf
|| 'To: '
|| recpt
|| crlf
|| 'Mime-Version: 1.0'
|| crlf
|| 'Content-Type: multipart/mixed;
boundary="DMW.Boundary.605592468"'
|| crlf
|| ''
|| crlf
|| v_message
|| crlf
|| ''
|| crlf
|| '--DMW.Boundary.605592468'
|| crlf
|| 'Content-Type: text/plain;
name="v_message.txt"; charset=US-ASCII'
|| crlf
|| 'Content-Disposition: inline; filename="v_message.txt"'
|| crlf
|| 'Content-Transfer-Encoding: 7bit'
|| crlf
|| ''
|| crlf
|| v_message
|| crlf
|| crlf
|| crlf;
UTL_SMTP.write_data (v_conn, v_msg);
/***** Prepare the attachment to be sent *****/
v_msg :=
crlf
|| '--DMW.Boundary.605592468'
|| crlf
|| 'Content-Type:
application/octet-stream; name="'
|| pfilename
|| '"'
|| crlf
|| 'Content-Disposition: attachment; filename="'
|| pfilename
|| '"'
|| crlf
|| 'Content-Transfer-Encoding: 7bit'
|| crlf
|| crlf;
UTL_SMTP.write_data (v_conn, v_msg);
LOOP
BEGIN
UTL_FILE.get_line (v_file_handle, v_line);
EXCEPTION
WHEN NO_DATA_FOUND
THEN
EXIT;
END;
v_msg := '*** truncated ***' || crlf;
v_msg := v_line || crlf;
UTL_SMTP.write_data (v_conn, v_msg);
END LOOP;
UTL_FILE.fclose (v_file_handle);
v_msg := crlf;
UTL_SMTP.write_data (v_conn, v_msg);
v_msg := crlf || '--DMW.Boundary.605592468--' || crlf;
UTL_SMTP.write_data (v_conn, v_msg);
UTL_SMTP.close_data (v_conn);
UTL_SMTP.quit (v_conn);
EXCEPTION
WHEN OTHERS
THEN
p_stat := 99;
END;
Thank You
Shan

I would recommend not to use home grown email solutions and use what we all use
1. UTL_MAIL oracle package http://download-west.oracle.com/docs/cd/B13789_01/appdev.101/b10802/u_mail.htm
or
2. SMTP rock solid solution http://www.oracle.com/technology/sample_code/tech/pl_sql/htdocs/maildemo_sql.txt

Similar Messages

  • How to send email attachments in body not as file

    i use btyahoo but i can change this. Im trying to send marketing emails to clients from ipad, i have made my flyer in pages and want that to show up in my email body and not as a file to download. How can i do this?
    Thank u!

    Michael-
    Different mail programs handle attachments differently.  You might send a graphic image or a photograph as an attachment, and it will arrive as part of the message body.  In other words, your flyer might work as an attachment if it was created as a JPEG image or could be converted to one.  But some of your clients may not have the same mail program, so their flyer would arrive as an attachment that needed to be downloaded.
    To do what your initial question asked, you would probably need a different mail App that would allow HTML as Allan stated.  I don't know if such an App exists for the iPad.  This may be one of those cases where you are trying to use an iPad to do a computer's job!
    Fred

  • How do I send multiple attachments in word format when the document is created in pages

    How do I send multiple attachments in word format on one em. The documents are in pages/numbers and if I use 'share' they each go into a separate  e mail

    Your welcome.
    New problem. Just purchased Docs Go Pro for iPad  word processor and there are buttons missing. Then when I go back to the App Store I clicked on app support and up comes server/webpage gone (basically). I Binged and there is not a direct site for support. How or who can be a help?

  • How to send email notification in different languages in Workflow ?? Urgent Help Needed

    Gurus,
    How to send email notification in different languages in Workflow? Can anyone send me some useful guidelines or link where it is mentioned.

    There is no profile option available to specify whether send or not send email notification.
    But after login, in preferences youcan set the notification preference value by which you can configure whether to send or not
    to send email notifications.
    If you select ''Do not send me mail' or 'Disabled' it will not send.
    For other values it sends the notfication in different formats like text, html, attachments etc...
    Edited by: sarojak on Jun 27, 2011 7:18 AM

  • Trouble sending email attachments or using photo mail

    Hi. I have Elements 6.0 and I'm using a HP computer with Vista. Starting about three days ago (for sure that I know of), I have not been able to send pictures by email attachment or photo mail in SHARE. I have been able to send pictures without problems in the past. When I "send" the pictures, everything looks fine (counting down of pictures sent displays and disappears as usual). When I pull down "find" and then "by history" and then "emailed to", its says my emails have been sent and how many pictures I have sent.
    So, that is my question. What has happened that I can't send email attachments anymore and how can I fix it?
    Thank you for any help or suggestions!
    Laura

    Well I had a brief moment of elation this am. All 26 of the test images I mailed to myself showed up in my mail box and my husbands. Thought it was all fixed. Tried to mail another and so far have not received it. Is it possible that the speed of delivery is REALLY slow? There has always been an inordinate lag time in receipt; about 7 to 10 minutes. But 3 days seems a little ridiculous. In the mean time I registered for the free adobe photoshop. It is bare bones, really easy, and it works. Their email does not have imbedded photos, but it does work. Just go to photoshop.com.

  • How to send the output to PDF format in reports 6i?

    Hi,
    How to send the output to PDF format in reports 6i? I given Mode = BITMAP.
    DESTYPE = File, DESFORMAT = PDF, DESNAME = C:\x.pdf.
    Report is running fine. But PDF file not generated. I don't know what i missed. Any one can help this?
    Thanks
    Kavitha

    Hello,
    Do you get this problem only for DESFORMAT=PDF ?
    Test with :
    DESFORMAT = RTF, DESNAME = C:\x.rtf
    or
    DESFORMAT = HTMLCSS, DESNAME = C:\x.html
    does it work ?
    Check if DESNAME is modified in the reports itself.
    Regards

  • How to send emails from HANA SQL Console

    Hi,
    Please guide how  to send mail from HANA Studio SQL Console.
    Is there any standard procedure in Hana Studio to send Mail( e.g. in MS SQL  "sp_send_dbmail" Procedure)

    Hi Preethi,
    Please go through the attached link:
    How to send emails from HANA
    Regards,
    Krishna

  • Send Email Attachments OBE issue

    I was following the Oracle by Example (OBE) Sending Email Attachments and I got to step 10, under the section Create Items to Store Email Information, setting the LOV for the list of employee pictures and the LOV is being displayed with the filename followed by the html :
    dog.gif<br /><img src="apex_util.get_blob_file?a=47495&s=1109906965016602&p=3&d=1822025729045755026&i=1822025415006755025&p_pk1=100&p_pk2=&p_ck=29A415A69350497EF7ED9962C42E9BA5" height="128" width="128" />)The LOV select statement is as follows:
    select filename||'</br>'||
    decode(nvl(dbms_lob.getlength(photo),0),0,null,
    '<img src="'||apex_util.get_blob_file_src('P3_PHOTO',employee_id)
    ||'" height="128" width="128" />') img,
    employee_id r
    from oehr_employees
    where mimetype like 'image%' order by 1
    I get the hmtl tags literals not the actual html.
    Why isn't showing up as html tags?
    I put it on apex.oracle.com:
    Logon credentials:
    Workspace: RGWORK
    Username: TESTER
    Password: test123
    Application: 47495. OBE New Features
    Page: 6
    The how-to tutorial is located at:
    http://www.oracle.com/technology/obe/apex/apex31nf/apex31email.htm
    Robert
    http://apexjscss.oracle.com

    Sorry - thought you were doing a report. I checked your app and the issue is security - in the Security region within Item attributes, Escape Special Characters was set to Yes (thus, you see the img tag rather than the image) - I changed this to No and now your image shows.
    This is an old obe (for 3.1), that is why this step is not included. When we create items and reports, we make them a bit 'tighter' by default now.
    -- Sharon
    p.s. cute puppy

  • Just want to find out how to send email? Can receive just fine, but cant send?!?!

    Hi Just wanted to find out how to send email? can receive just fine but cant send. Using hotmail at the moment.
      Any help would be great
    Thanks

    go to your mail providers setup guide and compare every single setting to how your smtp setup in your settings are set
    and if they are not the same change yours to match their page
    and if they are the same contact your isp to inquire as to why they are blocking the ports your mail provider are using

  • [SOLVED]How to send email to a local user?

    I have installed Mutt, msmtp, procmail and I can send and receive emails to/from remote hosts and I'd like to send email locally also (to the recipients on the same machine as the sender).
    When I try to send email to a local user from the root account -
    echo "Test message" | mail -s "Test subject" localuser
    then I get an error that connection to the port 25 is refused. Because the /etc/msmtprc file contains the 'localhost' as the default account's host, and on the local host I don't have a mail server listening on 25 port running.
    When I try to send email from a non-root account which has in /$HOME/.msmtprc file a real email account on a remote server, then of course there is an error that the domain for the email address 'localuser' is not recognized.
    How can sending email to local users be enabled?
    Last edited by nbd (2014-09-30 22:33:37)

    If I understand correctly, postfix it's a constantly running daemon. Seems to be an overhead for delivering only from time to time sent messages.
    ewaller wrote:
    > Out of the box, sendmail should be safe, but I think you have to enable local mail.
    Currently I have msmtp-mta installed, which is described as having sendmail functionality. If I install sendmail - will it be possible to send local email without running email daemons?

  • How to send a mail in pdf format file in sbwp??

    how to send a mail in pdf format file in sbwp?? and how to read the content of the mail?

    Refer the following link for Sample Program:
    http://www.sapdevelopment.co.uk/reporting/rep_spooltopdf.htm

  • Ping all the servers into SP farm using powershell script and send email only if any of them failed to ping.

    Hi,
    i am trying to have such kind of functionality, so that if any servers in sharepoint farm failed then it will send notification email to specific user that server is not able to ping or failed. Right now following script is working but it sending mail either
    servers are all running or dead. But i would like to send email only if any of the server failed to ping. what i need to modify following code to work.
    Thanks in advanced
    #### Provide the computer name in $computername variable 
    $ServerName = "localhost","Dc-XX"  
    $smtp = "ExchChange" 
    $to = "[email protected]
    $from = "[email protected]
    $sub = " Server Status" 
    $body = @" 
    ##### Script Starts Here ######   
     foreach ($Server in $ServerName) { 
                        if (test-Connection -ComputerName $Server -Count 2 -Quiet ) {  
                            $body += write-output "$Server is alive and Pinging `n"  
                                } else { $body += Write-output "$Server seems dead not pinging `n"  
    $body 
    send-MailMessage -SmtpServer $smtp -To $to -Subject $sub -Body $body  -From $from   

    you need to put a check on the send-mailmessage if no ping fails then exit else send the email with message.
    also try this script, performing the the same thing but more granular way
    http://gallery.technet.microsoft.com/scriptcenter/d0670079-6158-4dc5-a9da-b261c70e4b7d#content
    Please remember to mark your question as answered &Vote helpful,if this solves/helps your problem. ****************************************************************************************** Thanks -WS MCITP(SharePoint 2010, 2013) Blog: http://wscheema.com/blog

  • How to send emails from of pdf's generated by oracle reports

    I have several pdf documents , I want to email those pdf's . Please let me know how to send emails from oracle reports .
    Thanks,
    Previn

    I have integrated Oracle Reports with Oracle Portal and used the scheduling feature via portlets. We have reports that run every monday morning for management. For more info go to:
    http://otn.oracle.com/products/reports/htdocs/getstart/demonstrations/index.html
    OR
    I think if you set destype=mail, desformat=PDF, and desname=[email protected] that should also do the trick.
    Just be sure that you have put your mail server's IP address in the rep_<machine_name>.conf file located in your <oracle_home>/reports/conf directory. If this is not set up, the mail feature won't work.
    Martin

  • How to send emails to spam folder?

    I just got my Note4 and the phone's Help tells me that I need to select the email, then the bottom menu will populate with a little red circle with a + in it. I am to click that and the email address is sent to spam. But my bottom menu is NOT giving me that spam icon to click.  How can I block emails? Or how can I get that little icon to show up?
    Thanks!!

    Yes, I have unsubscribed to the emails that allowed me too. Now I would
    like to block spefic addresses and/or domains.
    My email addresses are @verizon.net, @gmail.com and a corporate one. I am
    using Gmail for the Gmail accounts and using the default email service that
    came on the phone. It's icon is an envelope with a red @
    I know the gmail service allows me to easily click "report spam"  but using
    note 4  how can I block emails in my  verizon.net account and corporate
    account?
    Thanks.
           <https://community.verizonwireless.com>
    A message from the Verizon Wireless Community
    <https://community.verizonwireless.com>
    <https://www.verizonwireless.com/wcms/consumer/explore.html> 
    <http://www.verizonwireless.com/wcms/consumer/shop.html>  [image: MY
    VERIZON] <http://www.verizonwireless.com/b2c/myverizonlp/> 
    <http://www.verizonwireless.com/support/>
       how to send emails to spam folder?  created by Verizon Wireless Customer
    Support <https://community.verizonwireless.com/people/vzw_customer_support>
    in Android - View the full discussion
    <https://community.verizonwireless.com/message/1176922#1176922>

  • How to sending email from Oracle Forms

    How to sending email from Oracle 6i(Forms)
    I need to send email to a distribution list(multiple email addresses).

    send email of multiple email address
    [email protected],[email protected],[email protected]
    create or replace function mailout
    (sender in varchar2,
    recipient in varchar2,
    ccrecipient in varchar2,
    subject in varchar2,
    message in varchar2) return number
    is
    crlf varchar2(2) := chr(13)||chr(10);
    connection utl_smtp.connection;
    mailhost varchar2(50) := 'Add email server Ip Address here';
    header varchar2(4000);
    v_num number :=1;
    str number:=0;
    email varchar2(50);
    begin
    connection := utl_smtp.open_connection(mailhost,25);
    header := 'Date: '||to_char(sysdate,'dd mon yy hh24:mi:ss')||crlf||
    'From: '||sender||' '||crlf||
    'Subject: '||subject||crlf||
    'To: '||recipient||crlf||
    'Cc: '||ccrecipient||crlf||message;
    utl_smtp.helo(connection,mailhost);
    utl_smtp.mail(connection,sender);
    utl_smtp.rcpt(connection,recipient);
    while (instr(ccrecipient,',',1,v_num)>0) loop
    email:=substr(ccrecipient,str+1,instr(ccrecipient,',',1,v_num)-str-1);
    dbms_output.put_line(email);
    utl_smtp.rcpt(connection,email);
    str:=instr(ccrecipient,',',1,v_num);
    v_num:=v_num+1;
    end loop;
    utl_smtp.open_data(connection);
    -- utl_smtp.write_data(connection,header);
    utl_smtp.write_data(connection,'MIME-Version:1.0'||crlf||'Content-type:text/html'||crlf||header);
    utl_smtp.close_data(connection);
    utl_smtp.quit(connection);
    return 0;
    exception
    when utl_smtp.invalid_operation then
    dbms_output.put_line('Invalid Operation in SMTP transaction');
    return 1;
    when utl_smtp.transient_error then
    dbms_output.put_line('Temporary problem with sending email ');
    return 2;
    when utl_smtp.permanent_error then
    dbms_output.put_line('Permanent problem with sending email ');
    return 3;
    end;

Maybe you are looking for

  • Optimum online email will not open on new macbook pro?

    I just got my macbook pro and i was trying to set up my optimum email. It wasnt working in the mail setup on my mac so i tried to log onto the optimum online site to make sure it was the right logon and password. I logged onto the account but once i

  • BPM CBS - Exception during process compilation

    Hi Experts, I am developing a BPM process using SAP NWDS 7.2 and a remote NWDI track. I have the following issue: When I edit my process, I create an activity for submit this changes. Later I try to check-in the activity and everything is okay, but w

  • Spotlight preferences not saved

    When I uncheck items in System Preferences/Spotlight/Search Results, my changes are not saved.  Spotlight continues to search for  categories I unchecked and when I open the Search Results preference window again, everything is still checked.  What g

  • How to clear the table control?

    Hi experts,   I have a table control in the selection screen of my program.When i enter some input values in the selection screen and execute it some process is done in the background and get a status message on the selection screen itself that the p

  • Issue with GP getting into Erroneous State

    Hi Experts I have an issue with GP Process getting into Erroneous State. We have a series of steps in the Guided Procedure Process. The process instance passes a few of the initial steps in the procedure and getting struck at a particular step and le