Send e-mail to multiple recipients that are entered in a form

Hello,
I wonder if somebody could help me...at least with the clue to do the following.
I have a form, with a textarea , where the people should put the e-mail addreses of all the people that, later will receive all the form data via e-mail..
I do not know how to retrieve all these e-mail addresses from the textarea (format?) and then how to send the e-mail to multiple recipients .
It works for one...but I do not know how to do this for several recipients...
could you please help?

use string tokenizer to tokenize the string and then use this in ur smtp coding
message.addRecipients(Message.RecipientType.TO, to)
where 'message' is object of MimeMessage
and 'to' is array of Address
ex:-
Address[] to = new Address[count];
Earlier u must be using message.addRecipient(Message.RecipientType.TO, to)
where to is object of Address.
Sample code:-
suppose String posted from ur form is :-
to = "[email protected],[email protected],[email protected]"
StringTokenizer toAdd = new StringTokenizer(to,",");
Address[] address=new Address[toAdd.countTokens()];     
int j=0;
while(toAdd.hasMoreTokens()){
address[j]=(new InternetAddress(toAdd.nextToken()));
j++;
}

Similar Messages

  • Sending Mails to Multiple Recipients using UTL_SMTP

    create or replace procedure send_mail(msg_text varchar2) is
    c utl_smtp.connection;
    PROCEDURE send_header(name IN VARCHAR2, header IN VARCHAR2) AS
    BEGIN
    utl_smtp.write_data(c, name || ': ' || header || utl_tcp.CRLF);
    END;
    BEGIN
    c := utl_smtp.open_connection('outlook.abc.com');
    utl_smtp.helo(c, 'abc.com');
    utl_smtp.mail(c, '[email protected]');
    utl_smtp.rcpt(c, '[email protected]');
    utl_smtp.open_data(c);
    send_header('From', '"root" <[email protected]>');
    send_header('To', '"abc" <[email protected]>');
    send_header('Subject', 'WARNING: Salary has been changed');
    utl_smtp.write_data(c, utl_tcp.CRLF || msg_text);
    utl_smtp.close_data(c);
    utl_smtp.quit(c);
    EXCEPTION
    WHEN utl_smtp.transient_error OR utl_smtp.permanent_error THEN
    BEGIN
    utl_smtp.quit(c);
    EXCEPTION
    WHEN utl_smtp.transient_error OR utl_smtp.permanent_error THEN
    NULL; -- When the SMTP server is down or unavailable, we don't have
    -- a connection to the server. The quit call will raise an
    -- exception that we can ignore.
    END;
    raise_application_error(-20000,
    'Failed to send mail due to the following error: ' || sqlerrm);
    END;
    ==============
    when I execute the above using
    sql> exec send_mail('hihihih');
    I am getting the mails..no problems...
    So..I created the following trigger and used the above procedure to send the mail...
    CREATE OR REPLACE TRIGGER test_emp_table_trg
    AFTER UPDATE
    ON test_emp_table
    FOR EACH ROW
    WHEN (NEW.sal <> OLD.sal)
    DECLARE
    l_employee_name VARCHAR2 (240);
    l_old_sal VARCHAR2 (240);
    l_new_sal VARCHAR2 (240);
    l_message VARCHAR2 (240);
    BEGIN
    /* Gets the employee full name */
    BEGIN
    SELECT ename
    INTO l_employee_name
    FROM test_emp_table
    WHERE empno = :OLD.empno;
    EXCEPTION
    WHEN OTHERS
    THEN
    l_employee_name := NULL;
    END;
    /* Gets the old Salary */
    BEGIN
    SELECT sal
    INTO l_old_sal
    FROM test_emp_table
    WHERE empno = :OLD.empno;
    EXCEPTION
    WHEN OTHERS
    THEN
    l_old_sal := 0;
    END;
    /* Gets the new salary */
    BEGIN
    SELECT sal
    INTO l_new_sal
    FROM test_emp_table
    WHERE empno= :NEW.empno;
    EXCEPTION
    WHEN OTHERS
    THEN
    l_new_sal := 0;
    END;
    l_message:=
    'Employee Name= '
    || l_employee_name
    || 'Old Salary= '
    || l_old_sal
    || 'New Salary= '
    || l_new_sal;
    BEGIN
    send_mail (l_message);
    END;
    END;
    ===================
    I am not getting desired output..what might be problem friends...I am getting 0 values for old salary and new salary......
    One more thing..when i use 2 receipts in the send_mail procedure like this...I added the following lines in the procedure to send to multiple receipents..
    ======
    utl_smtp.rcpt(c, '[email protected]');
    utl_smtp.rcpt(c, '[email protected]');
    =============
    Pleas have a look and correct me, where i went wrong....
    Edited by: oraDBA2 on Sep 22, 2008 3:12 PM

    Hi, You can use the following routine to send mail to multiple recipients through utl_smtp.
    create or replace package mail_pkg
    as
    type array is table of varchar2(255);
    procedure send( p_sender_e_mail in varchar2,
    p_from in varchar2,
    p_to in array default array(),
    p_cc in array default array(),
    p_bcc in array default array(),
    p_subject in varchar2,
    p_body in long );
    end;
    create or replace package body mail_pkg
    begin
    g_crlf char(2) default chr(13)||chr(10);
    g_mail_conn utl_smtp.connection;
    g_mailhost varchar2(255) := 'ur mail server';
    function address_email( p_string in varchar2,
    p_recipients in array ) return varchar2
    is
    l_recipients long;
    begin
    for i in 1 .. p_recipients.count
    loop
    utl_smtp.rcpt(g_mail_conn, p_recipients(i));
    if ( l_recipients is null )
    then
    l_recipients := p_string || p_recipients(i) ;
    else
    l_recipients := l_recipients || ', ' || p_recipients(i);
    end if;
    end loop;
    return l_recipients;
    end;
    procedure send( p_sender_e_mail in varchar2,
    p_from in varchar2,
    p_to in array default array(),
    p_cc in array default array(),
    p_bcc in array default array(),
    p_subject in varchar2,
    p_body in long );
    end;
    is
    l_to_list long;
    l_cc_list long;
    l_bcc_list long;
    l_date varchar2(255) default
    to_char( SYSDATE, 'dd Mon yy hh24:mi:ss' );
    procedure writeData( p_text in varchar2 )
    as
    begin
    if ( p_text is not null )
    then
    utl_smtp.write_data( g_mail_conn, p_text || g_crlf );
    end if;
    end;
    begin
    g_mail_conn := utl_smtp.open_connection(g_mailhost, 25);
    utl_smtp.helo(g_mail_conn, g_mailhost);
    utl_smtp.mail(g_mail_conn, p_sender_e_mail);
    l_to_list := address_email( 'To: ', p_to );
    l_cc_list := address_email( 'Cc: ', p_cc );
    l_bcc_list := address_email( 'Bcc: ', p_bcc );
    utl_smtp.open_data(g_mail_conn );
    writeData( 'Date: ' || l_date );
    writeData( 'From: ' || nvl( p_from, p_sender_e_mail ) );
    writeData( 'Subject: ' || nvl( p_subject, '(no subject)' ) );
    writeData( l_to_list );
    writeData( l_cc_list );
    utl_smtp.write_data( g_mail_conn, '' || g_crlf );
    utl_smtp.write_data(g_mail_conn, p_body );
    utl_smtp.close_data(g_mail_conn );
    utl_smtp.quit(g_mail_conn);
    end;
    end;
    begin
    mail_pkg.send
    (p_sender_e_mail => 'urmail',
    p_from => 'urmail',
    p_to => mail_pkg.array( 'urmail','othersmail' ),
    p_cc => mail_pkg.array( ' othermail ' ),
    p_bcc => mail_pkg.array( '' ),
    p_subject => 'This is a subject',
    p_body => 'Hello Buddy, this is the mail you need' );
    end;
    /

  • Sending mails to multiple recipients

    Hi,
    I need to send an e-mail to multiple recipients, none of which may know that the mail was sent to others as well. Of course, the first idea was to use the BCC-field. However, if I do that, the receipients get a mail with an empty To-Field, which looks both stupid and suspicious. Is there a way to send a mail in such a way that each recpient has their own address in the To-Field? I also played around a bit with Automator but I couldn't find anything.

    Hi Phunkjoker!
    I don't think you can, except by sending each individually.
    The only alternative that I can figure out is to send it to yourself, and have the other recipients in the BCC field?

  • Retrieve multiple e-mail address and send mail to multiple recipients

    Hello,
    I wonder if somebody could help me...at least with the clue to do the following.
    I have a form, with a textarea , where the people should put the e-mail addreses of all the people that later will receive all the form data via e-mail..
    I do not know how to retrieve all this e-mail addresses from the textarea (format?) and then how to send the e-mail to multiple recipients .
    It works for one...but I do not know how to do this for several recipients...
    could you please help?

    There is a setReceiptants method on the Message object.
    http://java.sun.com/products/javamail/javadocs/javax/mail/Message.html#setRecipients(javax.mail.Message.RecipientType,%20javax.mail.Address[])
    You will need to create an array of Addresses to feed it (just make space, commas, and semi-colons be tokens in your string and iterate it to create the address array)
    travis (at) overwrittenstack.com

  • How do I send mail to multiple recipients?

    I am running Mavericks 10.9.5.  I am having trouble sending mail to multiple recipients.  I type in the first person’s name and the e-mail address appears.  When I want to send mail to 2 more people, I can’t.  I type a comma and then a space and then the second person’s name.  All that appears is a duplication of the first person’s name.  I did not have this kind of trouble when I was running OS X, version 10.6.8.  I could type the names of all recipients in the “To”
    line.  What can I do?

    See the response to your other post

  • Problem in sending mails to multiple recipients

    Hellow ABAP gurus,
    i am stuck in a problem, where  cannot send the mail to multiple reciepients.
    actually i am adding recipients one after another, the email address is popualted already.just tell me if i am doing anything wrong..its not giving me any error. but its not taking any users in cc:
    i am new to Abap oops..so please help me n this.
    the code i am using is
    CALL METHOD w_document->add_attachment
            EXPORTING
              i_attachment_type    = 'PDF'
              i_attachment_subject = w_att_name
              i_att_content_hex    = pdf_content.
    *add document to send request
          send_request->set_document( w_document ).
    if w_covsmtp is not initial.
    *--add recipient (e-mail address
          w_recipient = cl_cam_address_bcs=>create_internet_address(
              i_address_string = w_covsmtp ). " w_addr-e_mail ).
    endif.
    *-- add recipient cc1 (e-mail address)
    if w_cc_mail1 is not initial.
          w_recipient_cc1 = cl_cam_address_bcs=>create_internet_address(
              i_address_string = w_cc_mail1 ). " w_addr-e_mail ).
    endif.
    *--add recipient cc2(e-mail address)
    if w_cc_mail2 is not initial.
          w_recipient_cc1 = cl_cam_address_bcs=>create_internet_address(
              i_address_string = w_cc_mail2 ). " w_addr-e_mail ).
    endif.
    *-- add recipient cc3(e-mail address)
    if w_cc_mail3 is not initial.
          w_recipient_cc1 = cl_cam_address_bcs=>create_internet_address(
              i_address_string = w_cc_mail3 ). " w_addr-e_mail ).
    endif.
    if w_recipient is not initial.
    *--add recipient to send request
          send_request->add_recipient( i_recipient = w_recipient ).
    endif.
    *--add recipient cc1 to send request
    if w_recipient_cc1 is not initial.
          send_request->add_recipient( i_recipient = w_recipient_cc1 ).
    endif.
    *--add recipient cc2 to send request
    if w_recipient_cc2 is not initial.
          send_request->add_recipient( i_recipient = w_recipient_cc2 ).
    endif.
    *--add recipient cc3 to send request
    if w_recipient_cc3 is not initial.
          send_request->add_recipient( i_recipient = w_recipient_cc3 ).
    endif.
    send document -
          sent_to_all = send_request->send(
              i_with_error_screen = c_x ).
          IF sent_to_all = c_charx.
            IF gv_screen_display = c_charx.
              MESSAGE i022(so).
            ENDIF.
            w_sent = c_charx.
          ENDIF.
    Thanks in advance,
    Rohan

    Well, it's been a while since I have used these classes to send some email, but what about changing the order of the calls for creating internet address and adding recipient like this:
    *-- add recipient cc1 (e-mail address)
    if w_cc_mail1 is not initial.
    w_recipient_cc1 = cl_cam_address_bcs=>create_internet_address(
    i_address_string = w_cc_mail1 ). " w_addr-e_mail ).
    endif.
    if w_recipient is not initial.
    *--add recipient to send request
    send_request->add_recipient( i_recipient = w_recipient ).
    endif.

  • How to use Add_Delivery_Option to send an email to multiple recipients

    I have the following code before i submit a concurrent request:
    B_Delivery_Success := Fnd_Request.Add_Delivery_Option(
    'E',                    -- EMAIL
    'Enter subject', -- SUBJECT
    '[email protected]',          -- FROM
    '[email protected]'          -- TO
    ,NULL               -- CC
    which correctly sends an email with attachment. However i need to send the email to multiple recipients. How can you enter multiple names against the 'TO' parameter. I know that i can repeat this again and again with a different email address each time, however there must be away to use this code once with multiple addresses?
    Edited by: user974582 on 09-Oct-2012 01:23

    Not sure about the API but there are other ways to achieve it i.e. through alerts.. You can refer below
    Can Concurrent Request Notifications Work With A Group Email ID [ID 1096850.1]
    Cheers,
    ND

  • TS3899 If I send an email to multiple recipients, I cannot open the individual replies on iphone

    If I send an email to multiple recipients, I cannot open the individual replies. I can see there are a few replies but have to go to webmail to see them.
    Any ideas anyone?

    ...and even email addresses can be hidden by sending to each recipient using your mail client's "bcc" or "blind copy" field instead of the "to" field.

  • The user or users have been added successfully, but there was an error in sending the e-mail message. The server may not be set up correctly to send e-mail. To verify that e-mail is configured correctly, contact your server administrator

    I got this problem when I tried to configure out-going email and add an account to farm administrator group.
    I configure out-going email according to this website http://technet.microsoft.com/en-us/library/cc288949.aspx
    Here are the screen shots.
    The SMTP server and email accounts work out OK when I use Outlook 2010 to test.
    Anyone can help me about it? Thanks.
    Here is the log.
    09/20/2012 09:21:00.36 w3wp.exe (0x1F7C)                      
    0x1138
    SharePoint Foundation         E-Mail                        
    8gsf
    High    
    #160008: The e-mail address 'admin3.sharepoint@domain' contains illegal
    characters. df98555c-612f-4a58-9443-ab6e9a4fcc53
    09/20/2012 09:21:00.36 w3wp.exe (0x1F7C)                      
    0x1138
    SharePoint Foundation         General                      
    8kh7 High    
    Cannot complete this action.  Please try again.
    df98555c-612f-4a58-9443-ab6e9a4fcc53
    09/20/2012 09:21:00.36 w3wp.exe (0x1F7C)                      
    0x1138
    SharePoint Foundation         E-Mail                        
    7946 Critical
    Cannot complete this action.  Please try again.
    df98555c-612f-4a58-9443-ab6e9a4fcc53
    09/20/2012 09:21:00.36 w3wp.exe (0x1F7C)                      
    0x1138
    SharePoint Foundation         Runtime                      
    tkau Unexpected
    Microsoft.SharePoint.SPException: The user or users have been added successfully, but there was an error in sending the e-mail message. The server may not be set up correctly to send e-mail. To verify that e-mail is configured correctly, contact your
    server administrator.    at Microsoft.SharePoint.ApplicationPages.AclInv.SendEmailInvitation(EntityEditor picker, String subject, String message)     at Microsoft.SharePoint.ApplicationPages.AclInv.BtnOK_Click(Object sender, EventArgs e)
        at System.Web.UI.WebControls.Button.OnClick(EventArgs e)     at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)     at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String
    eventArgument)     at System.Web.UI.Page.ProcessRequestMain(Boolean includeStage...
    df98555c-612f-4a58-9443-ab6e9a4fcc53
    The e-mail address I have tested it for several times and there is no problem.
    Anyone has any clue about this error?

    Hi.
    This I have seen before...
    It can be that the SMTP relay server is configured to only allow certain IP ranges or addresses.
    It can be that the firewall on the SP server does not allow for SMTP traffic (normally 25, for example for Exchange).
    It can be that there is an Antivirus on the SP server(Client AV) that prohobits the Timer service to send email from this server. I have seen MacAfee do this. Needed an policy change.
    If, its the builtin SMTP service you are using, check this link:
    http://blog.sharepointrx.com/2010/11/18/setting-up-the-iis-smtp-server-for-sending-email-from-sharepoint-2010-on-server-2008-r2/
    Check that and try again.
    Regards
    Thomas Balkeståhl - Technical Specialist - SharePoint -
    http://blog.blksthl.com
    Download the SharePoint Branding Project here
    Download the SharePoint 2010 Site Settings Explained here

  • Send PO Mail with PDF File that Chinese character doestn't display

    Send PO Mail with PDF File that Chinese character doestn't display.
    I am using RSTXPDFT4, unicode ECC6.0
    Some computer Adobe Reader can read the file, but some computer cannot read, just a blank page.
    Thanks.

    Hi
    I worked for one client-chinese where we have to print chinese & english ( bilingual).You need to have dricer program which could identify both scripts .You are right ( unicode0
    Please check for the driver program : TWPDF : PDF converter Chinese in SPAD setting.
    SAP note is available.I will check and let you update .
    Edited by: sunny on Oct 28, 2009 10:29 AM

  • Send PO Mail with PDF File that Chinese character doestn't display correctl

    Send PO Mail with PDF File that Chinese character doestn't display !
    I am using RSTXPDFT4 , tried different computer, some Adobe Reader can read
    some are Blank .......
    why ?

    Hi,
    那不是要每一台 PC 如果看不到中文就要更新 ?
    如果用戶不懂, 那就不是永遠看不見 ? 因為那是供應商嗎 !

  • HT5361 How can I forward mail to multiple recipients?  When I try to add an address, it replaces the previous address

    How can I forward mail to multiple recipients?  When I add an address, it replaces the previous address.

    Using the + button helped--should have been obvious, but I haven't been using it.  It works but seems very cumbersome to add one at a time.  I had another list of addresses that I could hold down the command button while selecting as many as desired, then click on BCC and double-click on just one of the addresses, and BCC would autofill with all of them.  Unfortunately, when I installed the latest Mac system update, I lost that multiple address capability--it's always something!

  • Mail to multiple recipients in sent mail index

    When I send mail to multiple recipients (all in the "To:" field), for some reason when I view the Sent index, only the first recipient shows up. (If I open the message, I see all recipients listed.)
    In Mail version 1, which I had been running on a prevoius machine with 10.2.8, all the recipients would appear in the sent mail index.
    For example, let's say I email Joe, Tom, Gary. If I go to the Sent mailbox, I only see "Joe" in the "To" column. Before, I'd see "Joe, Tom, Gary."
    Any way to change a setting to restore this? It makes it easier to see to whom I sent what.

    use string tokenizer to tokenize the string and then use this in ur smtp coding
    message.addRecipients(Message.RecipientType.TO, to)
    where 'message' is object of MimeMessage
    and 'to' is array of Address
    ex:-
    Address[] to = new Address[count];
    Earlier u must be using message.addRecipient(Message.RecipientType.TO, to)
    where to is object of Address.
    Sample code:-
    suppose String posted from ur form is :-
    to = "[email protected],[email protected],[email protected]"
    StringTokenizer toAdd = new StringTokenizer(to,",");
    Address[] address=new Address[toAdd.countTokens()];     
    int j=0;
    while(toAdd.hasMoreTokens()){
    address[j]=(new InternetAddress(toAdd.nextToken()));
    j++;
    }

  • Oracle Obiee - Send Obiee reports to multiple recipients

    Hello All,
    Can anyone tell me how to send Obiee reports to multiple recipients?
    I have used the ibot of Oracle Obiee. And ibot is working fine for the Creator of the ibot but it is not able to send reports to other recipients.
    When i get mail from Oracle Delivers the To section is empty and bcc section contains the creator of the ibot.
    Please help me on this.
    Thanks & Regards,
    Jiten
    Edited by: Dr.Jiten Patel on Aug 16, 2012 5:14 AM
    Edited by: Dr.Jiten Patel on Aug 16, 2012 5:15 AM

    Again, this is the Application Express forum, not the OBIEE forum.

  • How do you select and move more than one bookmark at a time? Shift+Click does not select multiple items that are next to one another in a list because the item

    How do you select and move more than one bookmark at a time?
    Shift+Click does not select multiple items that are next to one another in a list because the items open in firefox before this happens.

    Use the bookmarks library. You may use Shift +Click, and Ctrl + Click to create groupings of selected bookmarks to drag and drop.
    * one method of opening the bookmarks library is keyboard shortcut <br /> Ctrl+Shift+B (Windows)
    *see also [[How to use bookmarks to save and organize your favorite websites]]
    *and [[Use bookmark folders to organize your bookmarks]]

Maybe you are looking for

  • GL: Import Journal : Summary journals trace back

    Hi, If we "Import Journals" (*GLLEZL*) in GL with create summary journals as Y, how can we trace back from GL Journal table to subledger. Say for e.g. I Populated GL_INTERFACE.ATTRIBUTE1 as my_uniq_id value. After running "Import Journals" where is t

  • Is Pentium 4 2.8GHz compatible with Satellite P100?

    Hi I have an 18 month old Satellite P100 with a 1.6GHz processor (not dual core) and want to know if this laptop will happily work if I fit a 2.8GHz Pentium 4 processor or will it damage the motherboard? Cheers Wacky

  • On browsing music videos my iTune has gone USA!

    Yep -I'm now in American mode with my iTunes! all the monetry is in dollars-not that I've got anything against USA or dollars, but can some kind person out there tell me just how to get it back to English £'s please? The message I got from iTunes was

  • Returning parts to Apple question

    I called apple out of warrenty and paid $80 for a new power brick for my display. Was getting curious what went wrong with my original brick and new 100% it was the brick that was bad so I hacked open the brick and saw the grounding point was loose.

  • Problem in extracting data from another BW server

    Hello Experts I have two BW servers in landscape. One is used as stagins server and second server exctracts data form this server and is used as reporting server. I can see data in DSOs in stagins server, also checked export datasources in RSA3 in st