Sending email from DB to gmail

All,
I am on Oracle Database 11g Express Edition Release 11.2.0.2.0
Could anyone please help me on this. I am trying to get a sample code to send an email from DB to gmail/yahoo ( any mail client).
I have followed the instructions as said in the Send mail from PL/SQL - Oracle FAQ. But not able to send an email to gmail.
SQL> conn sys as sysdba
Enter password:
Connected.
SQL> @ D:\oraclexe\app\oracle\product\11.2.0\server\rdbms\admin\prvtmail.plb
Package created.
Package body created.
Grant succeeded.
Package body created.
No errors.
SQL> @ D:\oraclexe\app\oracle\product\11.2.0\server\rdbms\admin\utlmail.sql
Package created.
Synonym created.
SQL> select name, value from v$parameter where name like '%smtp%';
NAME
VALUE
smtp_out_server
SQL> alter session set smtp_out_server='127.0.0.1';
Session altered.
SQL> select name, value from v$parameter where name like '%smtp%';
NAME
VALUE
smtp_out_server
127.0.0.1
SQL> BEGIN
  2    --EXECUTE IMMEDIATE 'ALTER SESSION SET smtp_out_server = ''127.0.0.1''';
  3    UTL_MAIL.send(sender => '[email protected]',
  4              recipients => '[email protected]',
  5                 subject => 'Test Mail',
  6                 message => 'Hello World',
  7               mime_type => 'text; charset=us-ascii');
  8  END;
  9  /
BEGIN
ERROR at line 1:
ORA-29278: SMTP transient error: 421 Service not available
ORA-06512: at "SYS.UTL_MAIL", line 654
ORA-06512: at "SYS.UTL_MAIL", line 671
ORA-06512: at line 3
SQL>
Also i have tried another way as the below, but the same no result. Could anyone please help me out to send an email from DB to gmail / yahoomail. And also please tell me where can i find the settings for SMTP of gmail / ymail.
SQL> DECLARE
  2    v_c UTL_SMTP.connection;
  3    v_mailserver VARCHAR2(40);
  4    v_from       VARCHAR2 (40);
  5    v_to         VARCHAR2 (40);
  6    v_cc         VARCHAR2 (40);
  7    v_subject    VARCHAR2 (40);
  8    v_resp UTL_SMTP.reply;
  9  BEGIN
10    v_mailserver:='smtp.gmail.com';
11    v_from      :='[email protected]';
12    v_to        :='[email protected]';
13    v_cc        :='[email protected]';
14    v_subject   :='TEST MAIL';
15    v_resp      :=UTL_SMTP.open_connection (v_mailserver, c=>v_c);
16    v_resp      :=UTL_SMTP.helo (v_c, 'helo_text');
17    v_resp      :=UTL_SMTP.mail (v_c, v_to);
18    v_resp      :=UTL_SMTP.rcpt(v_c, v_from);
19    v_resp      :=UTL_SMTP.open_data(v_c);
20    UTL_SMTP.write_data(v_c, 'From: ' || v_from || UTL_TCP.crlf);
21    UTL_SMTP.write_data (v_c,'To: ' || v_to || UTL_TCP.crlf);
22    UTL_SMTP.write_data (v_c,'Cc: ' || v_cc || UTL_TCP.crlf);
23    UTL_SMTP.write_data (v_c,'Subject: ' || v_subject || UTL_TCP.crlf);
24    UTL_SMTP.write_data (v_c, 'Test Body');
25    v_resp:=UTL_SMTP.close_data(v_c);
26    UTL_SMTP.quit (v_c);
27  END;
28  /
DECLARE
ERROR at line 1:
ORA-29279: SMTP permanent error: 502 5.5.1 Unrecognized command.
jh13sm1540092bkb.13 - gsmtp
ORA-06512: at "SYS.UTL_SMTP", line 54
ORA-06512: at "SYS.UTL_SMTP", line 140
ORA-06512: at "SYS.UTL_SMTP", line 699
ORA-06512: at line 26
Also, is it possible to send the email from db to an email id which is on microsoft exchange server. if so, what are setting needed.
Thank you all.

Hello,
did you try to search this forum? You are not the first to ask this question
SQL and PL/SQL ?query=gmail
Regards
Marcus

Similar Messages

  • Why can't I send Emails from iPad apps?

    When I am using iBooks, or Evernote, or Hootsuite, or just about any application on my iPad that allows me to Email items from within the application, the following happens when I try to send an Email:
    1) I click the share button.
    2) Choose Emaill
    3) Write the Email.
    4) Click Send
    5) Hear swoosh sound and it appears the Email is sent.
    However, the Email is never actually sent.  I've tested this mutiple times to various Email addresses and it just isn't sending the Email.  The only exception is when I send Emails from within the Gmail app, in which case they send fine.
    After discovering this I took our my iPhone 5 and tried to do the same from there with the same applications.  I was able to send Emails from within the iPhone applications just fine so this problem is specific to my iPad.
    I checked my mail settings and didn't see anything out of order.  As I said, I can successfully send Email from the iPad using the Gmail app or just sending it from within a Chrome window.
    Thoughts?

    I used to be able to send e-mail from within apps on my iPad. Then all of a sudden, I was unable to do it. I changed none of my settings, and my regular e-mail works just fine.  One day I could e-mail from within apps, and then next I could not.
    When I hit the share button within an app, I then select the e-mail button. An e-mail message opens for composition. It has the subject line filled in, but that's all. It will not allow me to enter the address and it contains no message or link. It's just dead. Sometimes I wait for a while to see if anything changes, but it doesn't.
    Did apple change something without telling us?

  • I had a power failure 2 days ago, have power now, but cannot send email from my iPad. Everything was fine before that. The box says cannot send mail, the user name or password for Gmail is incorrect. I haven't changed anything. I need help. Thanks

    Hi
    I had a power failure 2 days ago, my computer is running again, but now I cannot send email from my iPad using Cox or my gmail account. I am receiving mail in my Cox account but not my gmail account.It was working fine until the power failure. It keeps telling me, the user name or password for Gmail is incorrect. I have not changed anything. I don't know what is wrong. Can anyone help me? Thanks

    I agree, unplug and replug your router, then reset your iPad by holding down the sleep and home buttons, ignore the red power down slider, and wait til you see the silver apple. let it reboot and then try your connection.
    Chances are rebooting the router will help. You may also need to talk to cox. They may need to reset something on their end.

  • TS3899 I have set up two email accounts on my iphone4, one with tiscali, my ISP, and the other on gmail. I am able to receive emails on both accounts, and can send emails from my gmail account, but am "Unable to Send Email" from my tiscali (talktalk) acco

    I have set up two email accounts on my iphone4, one with tiscali, my ISP, and the other on gmail. I am able to receive emails on both accounts, and can send emails from my gmail account, but am "Unable to Send Email" from my tiscali (talktalk) account. I get the error message "A copy has been placed in your Outbox. The sender address "name"@tiscali.co.uk was rejected by the server".

    Hi apmichael,
    If you are having issues sending email from one of your mail accounts on your iPhone, you may find the following article helpful:
    iOS: Troubleshooting Mail
    http://support.apple.com/kb/ts3899
    Regards,
    - Brenden

  • How can I send email from my domain from my iPhone using Gmail

    I want to send email from my iPhone using Gmail/Exchange but I want my emails to come from my own domain.
    I've tried a few different methods but my email ends up crashing after a couple days.
    Is there a simplified process to solve this annoyance?
    Thanks in advance

    lukefromsudbury wrote:
    I have no idea what your're talking about. 
    Neither do I, nor any of the other posters in this thread.
    Watch the Video Here:
    http://www.theanywhereoffice.com/digital-lifestyle/how-to-send-mail-from-your-ow n-domain-using-gmail-and-iphone.htm
    Shows you exactly how to do what you want.

  • How can i send email from a custom domain connected to gmail on iphone?

    Hi there,
    I am trying to add a gmail account to my iphone 5S which i have added a custom godaddy email to through pop3 but when i add the gmail account i cant send from the custom domain email.
    lets say the account is [email protected] with a [email protected] email attached to it, is there a way of sending emails from my iphone from this address?
    I have tried to find other guides but cannot seem to.
    thanks in advance

    Look in the JavaMail forum on how to create Mime format emails. This allows you to use HTML instead of plain text.
    Anthony

  • How do I send email from a gmail account

    How do I send email from a gmail account on my Macbook air?

    you have to setup your mail account in your macbook air

  • TS3899 In my iPad 2 with IO6 today I can not send emails from my gmail account, they go to the outbox directly...why? How can i solve this problem? ..I restarted the IPad but the problem was not solved. Please help.

    In my iPad 2 with IO6 today I can not send emails from my gmail account, they go to the outbox directly...why? How can i solve this problem? ..I restarted the IPad but the problem was not solved. Please help.

    Greetings,
    Questions:
    1. What version of the Mac OS are you running (Apple > About this Mac)?
    2. What version of the iOS are you running (Settings > About)?
    3. Do you use MobileMe/ iCloud or another server based sync solution like Google or Yahoo?
    4. Do other changes to synced information like Address Book content sync successfully back and forth?
    Based on your description it sounds like you have a 1 way sync issue.  Events sync fine between the iOS devices and fine from the computer to the iOS devices but not from the iOS devices to the computer.
    Try:
    Backup your computer and iOS devices before doing anything else:
    http://support.apple.com/kb/HT1427
    http://support.apple.com/kb/ht1766
    Ensure all the devices in use are fully up to date: Apple > Software Update / Settings > General > Software Update
    Make separate backups of critical data:
    Backup your computer Addressbook: http://docs.info.apple.com/article.html?path=AddressBook/4.0/en/ad961.html
    Backup your computer iCal: http://support.apple.com/kb/HT2966
    Reset syncing on your Mac: http://support.apple.com/kb/TS1627
    Reply back if that does not resolve your issue.
    Hope that helps.

  • I am using Mail 5.3 with two separate gmail addresses. One is personal the other is business. When I send emails from the business address, any auto-replies I get COME TO THE PERSONAL INBOX. I imagine that this is a setting? Please help!

    I am using Mail 5.3 with two separate gmail addresses.
    One is personal the other is business.
    When I send emails from the BUSINESS address, any auto-replies/out of office notices I get come to my PERSONAL INBOX.
    I imagine that this is a setting? Please help!

    Edit the SMTP server list. Add a new one for the business account. Put the correct password and information for it. Give it a description so you will know which server is which. Mke sure the correct server is highlighted in the account selected and check the box to use only that server for that account. Do that for the other account also.

  • Gmail will not send emails from mail

    On my Gmail account I am unable to send emails from mail on my iMac. I have OS X 10.9.1
    I have tried several times turning on and off 2 - step verification.
    I have also entered the generated password in the SMTP server as well.
    Message says: SMTP-server.gmail....  Could not connect
    When I edit SMTP server list how do I fill that in.
    ie Description, server name TLS Certificate.

    Does this mail ID supports either POP or IMAP protcol? Report this issue to your carrier they will raise a ticket to RIM for resolving the issue.
    tanzim                                                                                  
    If your query is resolved then please click on “Accept as Solution”
    Click on the LIKE on the bottom right if the post deserves credit

  • TS3899 How do I get my list of contacts from Gmail to my iPad2 so I can send email from the iPad?

    How do I get my list of contacts from Gmail to my iPad2 so I can send email from the iPad?

    Take a look at this help site that I found by using Google ...
    http://support.google.com/mobile/bin/answer.py?hl=en&answer=138740

  • Cant send emails from gmail or yahoo when connected to vpn

    I use a vpn to mask my IP address. When I am connected through my VPN I cannot send emails from my gmail or yahoo accounts through thunderbird
    If i disconect vpn they go through fine

    Just a guess, but if you change the outgoing server name to an IP address such as 74.125.136.108 for Gmail, does it work?
    https://support.hidemyass.com/entries/24893686-SMTP-Sending-emails-while-connected-to-VPN#thunderbird

  • Sending emails from my Gmail account set up in Outlook 2007

    Ever since I have signed up for Fios, I have been unable to send emails from my  Gmail account I have set up  in Outlooks.  I have tried changing the outbound port from 25 to others to no avail.  Can anyone please help?
    thanks

    adrock980 wrote:
    Thanks
    -My incoming mail works fine, and my account type is set to IMAP & incoming server is IMAP as well - will that screw things up?
    -I changed the settings on the outgoing servers to match exactly the directions at the google website instructions you linked me to, and I get the following error:
    "Send test e-mail message: Outlook cannot connect to your outgoing (SMTP) server.  If you continue to receive this message, contact your server administrator or Internet service provider (ISP)."
    IMAP or POP on the incoming shouldn't make any difference for outging. If it's working, don't mess with it.
    I looked at the page for IMAP settings as well, and they still say smtp.gmail.com on port 587 with TLS enabled and authenticate with same settings as incoming.
    Do you have any security software installed? Some of those programs run a scan on outgoing messages that can cause a timeout. Try temporarily disabling your security software to see if that resolves the issue. Either way, enable it again when done testing. If that fixed the issue, you can try increasing the timeout limit in the Outlook settings, or try adjusting the settings on your security software based on their instructions.
    If a forum member gives an answer you like, give them the Kudos they deserve. If a member gives you the answer to your question, mark the answer as Accepted Solution so others can see the solution to the problem.
    "All knowledge is worth having."

  • "Cannot send email from this device"?

    I recently purchased the Easy Release App from the ITunes store and when I try to email the release to my email address it says "Cannot send email from this device". Is it the app that is preventing the sending or is it something to do with the iPod? I've tried sending an email from the iPod to see and it is sent fine from the iPod but the app still won't send from the iPod.
    Has this ever happened to someone else? Do I have to change settings on my iPod?
    I have the IPod 4th generation if that helps

    I had the same problem. You have to go into Settings in your ipod touch, scroll down and find "mail, contacts, calendars." Set up your email in there. It will give you a list I.e. yahoo, hotmail, gmail. After you've dont that you'll be able to sent the model release.

  • Suddenly cannot send email from MSOffice 2010

    Starting Thursday, I began getting a pop-up box in Outlook (MSOffice for Home and Business 2010) regarding my password. Thinking I had been hacked, I changed the password but continue to receive the error.  Since then, I have been able to receive, but not send emails from Outlook.  I am not having any problems on my iPhone, iPad, or iCloud.com with sending or receiving my me.com emails.  In Outlook, i am not having any problems sending/receiving from my gmail account.
    Today I deleted the account from Outlook, then added it back.  It is saying it cannot send the test email:
         Cannot send the message.  Verify the email address in your account properties.  The server responded: 530.5.7.0 No STARTTLS command has been given. 
    based on that, i tried using the email address as   icloud.com instead of me.com but get the same error message.
    When i open the icloud control panel it says that iCloud is not set up in Outlook.  I activate it and it shows as set up, but then when i open Outlook, the icloud control panel goes back to showing that it is not set up in Outlook. 
    Help!!

    Sadly, this is still not working.  I did fix the In and Outbound server names, but I have some questions about how to configure the rest per the settings you directed me to.
    I have attached images showing you how I am configured now and I am still getting the same error message indicated above when I attempt a test.  The outbound email is still not working.
    If I select requires authentication I get the following error when trying to use it.
    For the Outgoing server, if i try SSL or TLS or Auto, I get the following error when trying to use it.

Maybe you are looking for

  • Why is the notification center different on ipad mini and iPhone?

    For instance.. Weather shows in the notification center on ipad mini, and not on iPhone. Also, calculator shows on iPhone control center and not ipad mini. I can understand why the calculator doesn't display as an option for the ipad mini as the calc

  • S/PDIF Output Issue

    I have a Auzentech X-Fi Forte & I'm facing a weird problem. Whenever I play something using the coaxial output via DDL or DTS every now & then the sound blanks out for few seconds while the video/song continues progressing. It doesn't happen when usi

  • Poor performance in Lightroom 5 on Slideshow save as video (mp4)

    Installed Lightroom 5 upgrade.  On LR 4 I can export a 55 slideshow as MP4 with 1080p preset using all four cores on a win7-64 (Intel I7) in about 6-8 min (used 70-80% processor).  In LR5, the CPU never goes above 15% processor and takes 45-50 minute

  • Issues with AS3 Project

    Not sure if anyone can help however I came across a tutorial by Lee Brenmlow titled 'Advanced After Effects and Flash' at www.gotoandlearn. The tutorial is great however I get an error when I test my movie and I think it is something to do with the t

  • HT204053 I have snow leopard version 10.6.8 how do I get my email?

    I have snow leopard version 10.6.8. How do I get my email now?