Send mail to list group with PL/SQL

I have a source code for sending mails using PL/SQL, but when I tried to put a group list name it doesn't work.
For example I have a group list called "several" this is the name of the group which mail addres is [email protected]
When I send a mail to [email protected] also the message must be sent to this directions [email protected], [email protected], [email protected], which are the email adresses that belong to the group calle "several", when I try to send to this group the message is not sent.
As you know when you are try to send with outlook, firebird, etc and you write the name of the contact or group, because is most easier than write the email address.
Do you have some source code for sending mail?
This source code must send mails when in the TO parameter contains the name of the contact o name of group contacts without have to write the email address. I have do it in Java but I need to know if is posible in PL/SQL.
Best Regards
Edited by: Erik Dguez. Ant. on Mar 25, 2009 8:57 AM

Hello Erik Dguez,
for example...
Create OR Replace Procedure PRC_SEND_MAIL( pSender     IN Varchar2
                                         , pRecipients IN Varchar2
                                         , pSubject    IN Varchar2
                                         , pBody       IN Varchar2 ) Is
   vConn  Utl_Smtp.connection;
   vReply Utl_Smtp.reply;
   vRcpt  Varchar2(128);
   vRcpts Varchar2(2000);
Begin
   vReply := Utl_Smtp.Open_Connection( 'smtp.domain.com', 25, vConn, 60 );
   vReply := Utl_Smtp.Helo( vConn, 'domain.com' );
   vReply := Utl_Smtp.Mail( vConn, pSender || '@domain.com', Null);
   vRcpts := pRecipients;
   If Substr(vRcpts,Length(vRcpts),1) <> ';' Then
      vRcpts := vRcpts || ';';
   End If;
   Loop
      vRcpt  := Trim(Substr(vRcpts,1,InStr(vRcpts,';') - 1));
      vRcpts := Trim(Substr(vRcpts  ,InStr(vRcpts,';') + 1));
      vReply := Utl_Smtp.Rcpt( vConn,vRcpt,Null );
      If vRcpts Is Null Then
         Exit;
      End If;
   End Loop;
   vReply := Utl_Smtp.Data(vConn,'Subject: ' || pSubject || chr(13) || chr(10) || pBody);
   Utl_Smtp.Quit(vConn);
End;Hope this helps
Christian Balz

Similar Messages

  • Can't send mail to list

    Hello
    I am trying to send mail to a group of 1000 from my Address Book (this is not spam), and keep getting the message that the mail can't be sent. I've tried using the two mail-servers I'm connected to (Comcast and SpamArrest) to no avail. In the past if one address was missing the .com at the end of the address, or there was ",com" instead of ".com", the entire list was stopped (instead of the infinitely more logical, simply rejecting the bad address). Any ideas? Do I need to switch to another mail app?
    Thank you.

    This has been reported as [https://bugzilla.mozilla.org/show_bug.cgi?id=1060901 Bug #1060901]. If you have an account on Bugzilla, please consider voting for that issue.
    Several other people have sent in the same support request as you, noting this happened after they upgraded to version 31.1.
    The exact error message is: XXXX is not a valid e-mail address because it is not of the form user@host. You must correct it before sending the e-mail.
    '''This happens in Thunderbird 31.1.0 when your mailing list description includes several words separated by spaces.'''
    Although not ideal, these workarounds should let you use your mailing lists until a proper fix is implemented:
    * While composing an email open the address book and select the list you are trying to send to, highlight all the names in the list and drag them to the To: box. This uses your existing data without modifying it.
    * Replacing the blanks " " between the words in such lists' descriptions with an underscore "_". This requires modifying your mailing list(s) description(s).
    '''About automatic updates'''
    Automatic updates are the default in Windows.
    You can [https://support.mozilla.org/en-US/kb/configuration-options-updates?esab=a&s=automatic+updates&r=1&as=s customize such behavior], however, it's under '''Tools > Options > Advanced > Update'''.
    My suggestion would be to set it to '''Check for updates, but let me choose wether to install them.''', specially if you depend on email for critical / important business or personal matters.

  • Send mail to exchange server with TLS

    Hi,
    last month I enabled an oracle wallet TDE for creating encription for TS.
    Today, development team needs to send mail to exchange server with TLS.
    So I found this procedure on oracle support Doc ID 1323140.1
    My question is, can I use the same wallet to send mails from db?
    The Oracle Database  11.2.0.3
    Or I need to implement a different type of wallet with certificate?
    Is there, in this case,  a procedure step by step?
    I have never implemented that and I'm very confused....
    Thanks in advanced

    Hi, I have implemented a new wallet with certificates (for test SMTP.gmail.com) and i'm tryied to use this procedure:
    DECLARE
    mailhost VARCHAR2(64) := 'smtp.mydomain.it';
    sender VARCHAR2(64) := '[email protected]';
    recipient VARCHAR2(64) := '[email protected]';
    wallet_pwd VARCHAR2(64) := 'welcome1';
    wallet_loc VARCHAR2(64) := 'file:/etc/ORACLE/FRMSSYST/SMTP/';
    user_name VARCHAR2(64) := 'HDC021319';  -- alias for '[email protected]'
    user_pwd VARCHAR2(64) := 'password';  -- password of [email protected]
    mail_connection utl_smtp.connection;
    BEGIN
    -- Make a secure connection using the SSL port configured with your SMTP server
    -- Note: The sample code here uses the default of 465 but check your SMTP server settings
    mail_connection := utl_smtp.open_connection(
    host => mailhost,
    port => 25,
    wallet_path => wallet_loc,
    wallet_password => wallet_pwd,
    secure_connection_before_smtp => FALSE);
    -- Call the Auth procedure to authorized a user for access to the mail server
    -- Schemes should be set appropriatelty for your mail server
    -- See the UTL_SMTP documentation for a list of constants and meanings
    UTL_SMTP.helo(mail_connection, mailhost);
    UTL_SMTP.STARTTLS(mail_connection);
    UTL_SMTP.AUTH(
    c => mail_connection,
    username => user_name,
    password => user_pwd,
    schemes => 'LOGIN');
    -- Set up and make the the basic smtp calls to send a test email
    utl_smtp.helo(mail_connection, mailhost);
    utl_smtp.mail(mail_connection, sender);
    utl_smtp.rcpt(mail_connection, recipient);
    utl_smtp.open_data(mail_connection);
    utl_smtp.write_data(mail_connection, 'This is a test message using SSL with SMTP.' || chr(13));
    utl_smtp.write_data(mail_connection, 'This test requires an Oracle Wallet be properly configured.' || chr(13));
    utl_smtp.close_data(mail_connection);
    utl_smtp.quit(mail_connection);
    END;
    This procedure, works fine if I try to send an email to smtp.gmail.com (I tried first with gmail with appropriate certificates), but now, when I try to send an email to the local enterprise Exchange server  I get this error:
    ERROR at line 1:
    ORA-29279: SMTP permanent error: 503 5.5.2 Send hello first
    ORA-06512: at "SYS.UTL_SMTP", line 54
    ORA-06512: at "SYS.UTL_SMTP", line 140
    ORA-06512: at "SYS.UTL_SMTP", line 439
    ORA-06512: at line 35
    Thanks in adavanced

  • Cannot send mail to a group if hiding addresses

    I can't send mail to a group unless I show all member addresses. If I uncheck this preference I recieve the following error dialogue:
    This message could not be delivered and will remain in your Outbox until it can be delivered.
    Sending the message content to the server failed.
    Very frustrating and infuriating for my reciepients. Any ideas?
    MacBook Pro   Mac OS X (10.4.9)   2.16 GHz Intel Core Duo - 1GB 667 MHz RAM - 100GB

    Thank you Klaus,
    In mail help, Bcc is indicated as an alternative to unchecking the box saying show names in group when sending. Any ideas as to why the preference doesn't work?
    MacBook Pro   Mac OS X (10.4.9)   2.16 GHz Intel Core Duo - 1GB 667 MHz RAM - 100GB

  • How do I send mail link this page with iCloud

    I'm having problems sending mail link from safari with iCloud please.
    Please help

    There is an option to "Send Link..." in the File menu. Firefox does not have a built-in send page by email option.

  • I send mail via SMTP server with Hebrew text, and I get it gibberish on my iphone

    I send mail via SMTP server with Hebrew text, and I get it gibberish on my iphone

    What mail program from what kind of computer are you sending your email?  It sounds like an encoding problem that would have to be solved on the sending end.   If you want, send me an example of the kind of email which arrives as gibberish on your iphone (tom at bluesky dot org).

  • Send Mail to Contact Group

    I'm helping someone set up their new iPad.  One of the most common tasks she hopes to use it for is sending e-mail to several groups.  On her iMac she has the groups set up in Contacts.  To send a message to them she opens mail, selects the group, and all the addresses populate the To: field.
    The groups are there in iOS on the iPad too, but there doesn't seem to be any way to select them when you're sending a mail message.  If you go to the + button, click Groups (little back arrow), and click the group it just adds or removes the little check mark by the group name.  There's no way to chose the group to say "send to all these people."
    You CAN select just the specific group, go to the contact list, and tap each name one at a time to populate the To: field, but with 50+ e-mail addresses...  That's NOT a solution, that's a pain.
    There must be some way in iOS to send mail messages to everyone in a contact group... BUT HOW?
    Thanks!

    Um, Apple... REALLY?  Why on earth would they leave out something this fundamental?
    Please tell me they added it in iOS 7.  This is one of the primary reasons my friend bought the iPad.  She's considering ditching it because it can't do something as fundamental as send to a group.
    Thanks!

  • Notifications failed to send mail for journal approval with attachments

    Issue : Notifications failed to send mail for journals sent for approvals with attachments.
    Error :
    [WF_ERROR] ERROR_MESSAGE=3835: Error '-6502 - ORA-06502: PL/SQL: numeric or value error: character string buffer too small' encountered during execution of Generate function 'WF_XML.Generate' for event 'oracle.apps.wf.notification.send'. ERROR_STACK=
    WF_XML.GetAttachments(71009549, http://vfilvappclone.verifone.com:8000/pls/EBIZRPT, 13525)
    WF_XML.GenerateDoc(oracle.apps.wf.notification.send, 71009549)
    WF_XML.Generate(oracle.apps.wf.notification.send, 71009549)
    WF_XML.Generate(oracle.apps.wf.notification.send, 71009549)
    Wf_Event.setMessage(oracle.apps.wf.notification.send, 71009549, WF_XML.Generate)
    Wf_Event.dispatch_internal()
    Cause : Above error is thrown for Journals with attachment of file type Microsoft Office Excel Macro-Enabled Worksheet (.xlsm)
    Can anybody help with this?

    Please post the details of the application release, database version and OS.
    Please see if these docs help.
    ORA-20001 & ORA-06502 Workflow Errors [ID 761638.1]
    Manager Approval Notification Gives Error: Ora-O6502: Pl/Sql: Numeric Or Value Error: Character String Buffer Too Small [ID 352213.1]
    Approval Confirmation Email Is Not Received By Preparer - ERROR_MESSAGE=3835 ORA-20001 ORA-6502 [ID 465146.1]
    Notification Fails To Be Generated When A DOCX Document Is Attached [ID 1058183.1]
    Not Able To Send Multiple E-Mails Upon Approval Of Purchase Order [ID 333719.1]
    Expenses Workflow Error: "ORA-06502: PL/SQL: numeric or value error: associative array shape is not consistent with session parameters has been detected in fnd_global.put(CONC_LOGIN_ID,-1)" [ID 455882.1]
    Using Microsoft Office 2007 and 2010 with Oracle E-Business Suite 11i and R12 [ID 1077728.1] -- Notification Generation Fails
    ORA-06502 Buffer Too Small Error in Contracts Workflow Notification [ID 870712.1]
    Thanks,
    Hussein

  • Cannot Send Mail to Distribution Group

    We are running Exchange 2013 and have a problem where users are getting NDR reports when trying to send mail with a small attachment a Universal Distribution Group. The message received back is:
    Delivery has failed to these recipients or groups:
    _Group ([email protected])
    The recipient won't be able to receive this message because it's too large.
    The maximum message size that's allowed is 2 MB. This message is 3 MB
    Why are messages to distribution groups capped at 2MB and how can I increase it to at least 10?

    Hi Will,
    Check the distributiongroup maxreceivesize parameter. With Powershell.
    Get-DistributionGroup -Name <Name> | FL
    It can be changed using:
    Set-DistributionGroup -Name <Name> -MaxReceiveSize XXXXX
    It can also be changed in the Exchange Administreative Center here:
     Recipients > Mailboxes > EditEdit icon > Mailbox features > Mail flow > Message size restrictions > View details > Received messages
    You can Refer to this link for further Exchange 2013 Message size limits.
    http://technet.microsoft.com/en-us/library/bb124345(v=exchg.150).aspx
    All the best, Jesper Hassing - MCTS SCCM 2012 - MCSA 2012 Server - MCP

  • ODI Send Mail- To List

    Hi all,
    I want to use the odi send mail tool, and send the same mail to a large number of people, whose email id's have been retrieved from a database table.
    Kindly guide me as to how to retrieve a set of email id's from the databse and add them in the "to" list of Odi send mail tool.
    I thought of using a refreshing variable , but the refreshing variable should only return a single value. so this wont help.
    Kindly help.
    Thanks in advance.

    Hi,
    You can enter the email id's in table separating each with a comma (,). The email id's should be entered against a unique identifier, say your interface name.
    Insert a variable in ODI and in its refreshing tab put "select email_id from your_table where interface_name='your_interface_name".
    Use this variable in ODISendMail.
    Hope this helps!
    Ritika

  • Unable to send mail to multiple recipients with attachment

    I'm using a script given in the Oracle page - http://www.oracle.com/technology/sample_code/tech/pl_sql/htdocs/maildemo_sql.txt for sending mail with attachment. Although I'm able to send mail with attachment to a single user, but the same can't be done while the recipients are more than one. Can some one help me ?

    Hi,
    Ca you please send me an example set of parameteres that we need to pass to make this program work?
    I'm not able to attach a file to this program.Can youe please let me know how I can attach a file called 'Test.txt' kept at 'D:\' to this program?
    Thanks.
    Bhavin

  • Sending mail to a group

    Hi all
    I got the following example from the net. This is to send mail to one person, but how do I send the same message to more than one person?
    Thanx
    import javax.mail.*;
    import javax.mail.internet.*;
    import java.util.*;
    public void postMail( String recipients[ ], String subject, String message , String from) throws MessagingException
    boolean debug = false;
    //Set the host smtp address
    Properties props = new Properties();
    props.put("mail.smtp.host", "smtp.jcom.net");
    // create some properties and get the default Session
    Session session = Session.getDefaultInstance(props, null);
    session.setDebug(debug);
    // create a message
    Message msg = new MimeMessage(session);
    // set the from and to address
    InternetAddress addressFrom = new InternetAddress(from);
    msg.setFrom(addressFrom);
    InternetAddress[] addressTo = new InternetAddress[recipients.length];
    for (int i = 0; i < recipients.length; i++)
    addressTo[i] = new InternetAddress(recipients);
    msg.setRecipients(Message.RecipientType.TO, addressTo);
    msg.addHeader("MyHeaderName", "myHeaderValue");
    // Setting the Subject and Content Type
    msg.setSubject(subject);
    msg.setContent(message, "text/plain");
    Transport.send(msg);

    Here is an SMTP class I wrote using java mail. It supports mulitple addresses and attachements. When calling setToAddress make sure your addresses are in a string each seperated by a semi colon.
    package com.elg.utils;
    import java.util.*;
    import java.io.*;
    import javax.mail.*;
    import javax.mail.internet.*;
    import javax.activation.*;
    *This class is used to provide a easier means to send an smtp email using Java Mail
    * Last Updated: 11-3-2003  By: Paul Zepernick
    * @author     Paul Zepernick
    * @version 1.0
    public class SmtpEmail {
         /**array to hold attachments*/
         private ArrayList attachments = null;
         /**from email address*/
         private String fromAddress = null;
         /**to email address*/
         private String toAddress = null;
         /**email subject*/
         private String subject = null;
         /**email body*/
         private String emailBody = null;
         /**email properties*/
         private Properties props = null;
          * Constructs a new smtp class.
          * @param Smtp Server
          * @param Smtp Port - should be set to 25 for default
         public SmtpEmail(String smtpServer,int port){
              super();
              props = System.getProperties();
              props.put("mail.smtp.host",smtpServer);
              props.put("mail.smtp.port",String.valueOf(port)); 
              attachments = new ArrayList();
         public void sendMail() throws MessagingException{
                   Session s = Session.getInstance(props,null);          
                   MimeMessage message = new MimeMessage(s);     
                   message.setFrom(new InternetAddress(fromAddress));
                   message.addRecipients(Message.RecipientType.TO, buildAddress(toAddress));
                   message.setSubject(subject);
                   if (attachments.size() == 0){
                        message.setContent(emailBody, "text/plain");
                   }else{
                        Multipart mp = new MimeMultipart();
                        message.setContent(mp);
                        // Message part 1 is text - add to multipart
                        MimeBodyPart m1 = new MimeBodyPart();
                        m1.setContent(emailBody, "text/plain");
                        mp.addBodyPart(m1);
                        // Message part 2 is binary (file to send)
                        MimeBodyPart m2 = null;
                        /**add attachments to the multipart message*/
                        for (int i=0; i<attachments.size(); i++){
                             FileDataSource fds = new FileDataSource((String)attachments.get(i));
                             m2 = new MimeBodyPart();
                             m2.setDataHandler(new DataHandler(fds) );
                             m2.setFileName( new File((String)attachments.get(i)).getName() );
                             mp.addBodyPart(m2);     
                   Transport.send(message);
                   return;
          * Attachs a file to the email
          * @param String path to file
          * @return void
          * @exception FileNotFound
        public void attachFile(String path) throws FileNotFoundException{
             if (!new File(path).exists()){
                  throw new FileNotFoundException ("INVALID FILE");
             attachments.add(path);
          * Sets the emailBody.
          * @param emailBody The emailBody to set
         public void setEmailBody(String emailBody) {
              this.emailBody = emailBody;
          * Sets the fromAddress.
          * @param fromAddress The fromAddress to set
         public void setFromAddress(String fromAddress) {
              this.fromAddress = fromAddress;
          * Sets the toAddress. Seperate multiple to addresses by a semi colon
          * @param toAddress The toAddress to set
         public void setToAddress(String toAddress) {
              this.toAddress = toAddress;
          * Sets the subject.
          * @param subject The subject to set
         public void setSubject(String subject) {
              this.subject = subject;
          * Builds a to address array
          * @param String address list semi colon seperated
          * @return InternetAddress
         private static InternetAddress[] buildAddress(String addressList) throws AddressException{
              StringTokenizer st = new StringTokenizer(addressList, ";");
              InternetAddress[] address = new InternetAddress[st.countTokens()];
              int i = 0;
              while ( st.hasMoreTokens() ){
                   address[i++] = new InternetAddress( st.nextToken() );
              return address;
    }

  • Best way to send mail to a group of more than 500

    One of our users has to send email to a group of more than 500 (all external, not spam). What is the best way ? At present the user is using a php script and while the emails are sitting in the queue to be sent, all other user's emails are queued. Is there any other way (not using a second server).
    Also interested in knowing if there is anyway to see that these emails are not marked as junk by yahoo or hotmail.
    Appreciate your help.

    I would not have thought that 500 emails would take too much time to go out (but can the script be triggered at some time in the morning?). However, if you have a standard server then all outgoing mail will be getting scanned for junk & viruses (same as inbound) and that will take the majority of time spent. To avoid this, you can set up an alternative submission port which bypasses the scans. See UptimeJeff's web site how-to...
    http://mac007.com/?Tips:AlternateSMTPPorts
    The original forum thread prior to the website article...
    http://discussions.apple.com/thread.jspa?messageID=3008740
    As for yahoo/hotmail question, unless your server is badly configured (host name, etc) and/or the emails 'look' like spam, I would doubt they will trigger the usual tests. You could always create a yahoo/hotmail account to check.
    -david

  • When sending mail to a recipent with "unrouteable adress" I get a popupwarning. Is it possible to disable this popup?

    I am trying to disable a popup alert I get when I send a message to a recipient with an error.
    I get the message "Unrouteable adress" as a popup and have to press OK to continue to send mails. The reason I want to disable this is that we are using thunderbird to send out newsletter, and have to press OK on all adresses that is wrong.

    Another option is to make an Automator workflow that creates a new email message formatted as you like. Here are the steps:
    Open Automator and create a New Service.
    Set it to no input in Mail
    From the Utilities Library, drag the run Applescript action into the workflow pane.
    Copy and paste in this script (replacing what is already there):
    property fontName : "Lucida Handwriting"
    property fontSize : 14
    property fontColor : {14848, 26112, 65535} as RGB color
    property emailMessage : "Hello "
    on run {input, parameters}
              tell application "Mail"
                        set theMessage to make new outgoing message with properties {visible:true}
                        set the content of theMessage to emailMessage
                        tell content of theMessage
                                  set the font to fontName
                                  set the size to fontSize
                                  set the color to fontColor
                        end tell
              end tell
    end run
    Change all the Properties to what you want for defaults.
    Save the workflow with a useful name.
    Open Keyboard System Preferences, Shortcuts menu
    Select Services category
    Scroll to the bottom section and find you service; select it.
    Tab the shortcut field and type the shortcut you want to use. Note that a lot of the N shortcuts are used. I found ctrl-opt-N was free.
    Open Mail, go to the Mail menu > Services > name of service
    That will open a new mail window. Close it and try the Shortcut.
    To get the right color values, you can use the color picker, RGB Slider values multiplied by 256. That's not quite perfect, but it is close. The maximum value is 65535

  • Sending mail from JSP page with attachment

    I have a requirement to send mail with attachment from my jsp pages, which should come to a particular mail box. Can any one help me by sending sample codes. Thankx in advance.

    hi,
    When request is posted you have to save file data from request to a file. you can not access the data using request.getParameter("file").

Maybe you are looking for

  • Error,while importing METADATA from 9.0.3 to 9.2.0.2.8

    Folks, I am in the process of doing an OWB upgrade from 9.0.3 to 9.2.0.2.8. I did the design repository install (for 9.2.0.2.8), then runtime repository schema install and created runtime access user . Then I did an MDL export using the OWB client of

  • What's wrong with Gmail & Mail.app (IMAP)

    I recently set up Mail.app for Gmail using IMAP. Since then I've noticed that my inbox in Mail.app and in Gmail on the web is always out of sync. For example, I have one message listed in my inbox in Mail.app right now, and there are eight still in t

  • MacBook Pro not connecting to Airport Express, iPad connects fine

    Hi. Suddenly my Macbook Pro cannot connected to our wifi connection via Airport Express, though the connection is visible in the Airport drop-down and it shows full signal strength. My iPad connects fine.

  • Kernal Panic Issue 2013 rMBP

    So I was casually using my 2013 rMBP today and all of the sudden everything froze and it forced me to shut down. It is only a few months old so this definitely concerns me since I have never had an issue with any of my Apple products before. Does any

  • IE Browser Full Screen View

    I created an applet for my webpage and it works fine until I change to Full Screen View in IE Browser. I must click IE Browser Refresh to clean the image. How do I set things up to automatically refresh when I change the view to full screen?