Unable to send emails to multiple recipients through oracle storedprocedure

I have the email code working with single email in the To address but I am looping through the table and getting a semicolon separated emails and assining to_mail and I am unabl to send any emails to any users in To address but works for cc_address users. I am getting the following error in the stored procedure when compiling. Please help if any suggestions or any one came accross this issue. Thanks.
ORA-29279: SMTP permanent error: 501 #5.1.1 bad address @abc.com
ORA-06512: at "SYS.UTL_SMTP", line 29
ORA-06512: at "SYS.UTL_SMTP", line 110
ORA-06512: at "SYS.UTL_SMTP", line 252
ORA-06512: at "abc_owner.SendMail", line 101
ORA-06512: at line 10

900045 wrote:
I have the email code working with single email in the To address but I am looping through the table and getting a semicolon separated emails and assining to_mail and I am unabl to send any emails to any users in To address but works for cc_address users. I am getting the following error in the stored procedure when compiling. Please help if any suggestions or any one came accross this issue. Thanks.
ORA-29279: SMTP permanent error: 501 #5.1.1 bad address @abc.com
ORA-06512: at "SYS.UTL_SMTP", line 29
ORA-06512: at "SYS.UTL_SMTP", line 110
ORA-06512: at "SYS.UTL_SMTP", line 252
ORA-06512: at "abc_owner.SendMail", line 101
ORA-06512: at line 10when all else fails, Read The Fine Manual
http://docs.oracle.com/cd/E11882_01/appdev.112/e25788/u_smtp.htm#i1002798
RCPT Function
This subprogram specifies the recipient of an e-mail message.
"To send a message to multiple recipients, call this routine multiple times. "
"Each invocation schedules delivery to a single e-mail address."

Similar Messages

  • Can't send emails to multiple recipients any more?

    Yesterday I had to send an email to some 30 other people (I only do this occasionally).
    It refused to go and I received this error message:-
    I have several email accounts but each one was the same.
    At that time I could not even send single emails but incoming emails were unaffected.
    Later in the day I received this email from my ISP mail account.
    Your emails may be blocked – please confirm your alternate BT Yahoo! Mail addresses
    Dear Customer,
    You’ve received a ‘553’ error message because we’ve upgraded your BT Yahoo! Mail account security to help protect against ‘spoofing’ – when people use alternate email addresses to disguise the real sender, possibly to commit fraud.
    What you need to do
    We need you to take a few minutes to confirm each of the BT Yahoo! Mail alternate email addresses you use are genuine. If you don’t, you might get more ‘553’ error messages and have problems sending emails. Just log in and follow these simple steps. We don’t ask for any personal information.
    This is rubbish and I had a similar one last year which I ignored, as the simple steps were far from simple, and the following morning all was back to normal.
    So I ignored this email and tried again this morning.
    I was still unable to send emails to multiple recipients but now I can send single emails OK!
    Any ideas what is going on?
    Is it Mail's fault or my ISP's?

    From the error message, it looks like there was a problem with at least one of the addresses ("NONE"). It is possible that a bad address is in the list you tried to send to.
    I don't know anything about BT Internet, so I can't confirm the authenticity of the email you received.
    You should be able to log into your BT account directly from the web without using any links sent in the email.
    The email also seems to indicate you used an alias as the reply-to (from) email address.
    You didn't mask out the username for your smtp server and it is definitely different from the from account. This may all be normal, but it does tend to match what the email is telling you.

  • Question regarding sending email to multiple recipients

    Hi All,
    I am creating a workflow that will send an email notification everytime a new campaign is created. I've learned that R16 is capable of sending emails to multiple recipients, the only concern I have is I can't find any doumentation on how to do it. It is stated in the R16 Administrator Preview Guide that you can select 'Specific Email Address' and enter multiple email addresses directly, I tried to enter multiple email addresses separated by comma - [email protected],[email protected],[email protected] as an example, but it doesn't work and prompts me to enter a valid email address. Could anybody guide me on how to enter multiple email addresses once the 'Specific Email Address' is selected or how to do it in the expression builder to define the expression that will define the list of emails. I know that using group email addresses can be used as an alternative to this requirement but I hope theirs a way to do this with workflows.
    Thanks,
    Wayne

    According to the R16 Admin preview guide;-
    "Send Email to Multiple Recipients
    Expression Builder is now linked to the email address text field that is presented when the Specific Email Address
    option is selected. Workflow administrators can enter multiple email addresses directly, or click the "fx" icon
    beside the field, and use Expression Builder to define expressions that evaluate to one or more email addresses.
    The benefit of this feature is that emails can be stored on any text field in the base record and multiple emails can
    be sent using one workflow action. "
    But how that works exactly is not clear, I have tried commas, semi-colons, spaces, apostrophes, doublequotes, to separate and try to establish the correct syntax without luck.
    Bob - Perhaps you can do some digging and find out the correct syntax for multiple addresses?

  • On OnPremise, Sending email to multiple recipients doesn't work with SendEmail method

    Hi,
    We are creating a site collection on OnPremise from App by using Sharepoint Client API's (16 version).
    After creation of site collection, we are sending an email to all site collection administrators. But we found that email is being sent to the only first person mentioned in the "To" list. For sending email we are using following method "Microsoft.SharePoint.Client.Utilities.Utility.SendEmail()".
    We tried different scenarios by passing alternately domain username and email address.
    Here are the findings for the different scenarios for the "To" field:
    1) "domain\user1; domain\user1" => sends email to first user
    2) "[email protected]; [email protected]" => sends email to both emails (at least shows in inbox To field, two occurances of email)
    3) "domain\user1; domain\user2" => sends email to first user
    4) "[email protected]; [email protected]" => sends email to first user
    Here is the code we are using:
                    EmailProperties properties = new EmailProperties();
                    properties.To = to.ToList();
                    if (cc != null)
                        properties.CC = cc;
                    properties.Subject = subject;
                    properties.Body = body;
                    Utility.SendEmail(context, properties);
                    context.ExecuteQuery();
    Please let us know what is going wrong here.
    Thanks in advance for your valuable inputs.
    Br,
    Shriram
    Shri07

    According to the R16 Admin preview guide;-
    "Send Email to Multiple Recipients
    Expression Builder is now linked to the email address text field that is presented when the Specific Email Address
    option is selected. Workflow administrators can enter multiple email addresses directly, or click the "fx" icon
    beside the field, and use Expression Builder to define expressions that evaluate to one or more email addresses.
    The benefit of this feature is that emails can be stored on any text field in the base record and multiple emails can
    be sent using one workflow action. "
    But how that works exactly is not clear, I have tried commas, semi-colons, spaces, apostrophes, doublequotes, to separate and try to establish the correct syntax without luck.
    Bob - Perhaps you can do some digging and find out the correct syntax for multiple addresses?

  • Error while sending email to Multiple Recipients

    Hi,
    I am trying to send email to multiple recipients .It works fine if all the email-addresses are valid. If even one is invalid throws exception .I wish to send it all the valid addresses even if some are invalid as this email will be going to 3000 users some of them will be wrong addresses.
    Help is greatly appreciated.
    -ksg
    Exception thrown:
    Exception in SendEmail.setAddress as :javax.mail.SendFailedException: Invalid Addresses;
    nested exception is:
    javax.mail.SendFailedException: 550 <[email protected]>... User unknown
    Here is the main piece of code:
    message.saveChanges();
    Transport transport = session.getTransport("smtp");
    transport.connect("myhost", "", "");
    transport.sendMessage(message, message.getAllRecipients());
    transport.close();

    Hi there,
    Well I find the easiest way is to use a comma delimited string with the following bit of code.
    msg.setRecipients(
    addrType,
    InternetAddress.parse(smtpAddress, false));
    addrType will be TO,CC or BCC
    smtpAddress is a comma delimited string that I get from the results of a SQL Select request (looks something like "[email protected],[email protected],....,....,...."
    The boolean false is to prevent the parse checking the validity of the SMTP addresses as I prefer to deal with this by letting the SMTP server tell me which addresses are no good.
    Hope this helps,
    SH

  • How to send email to multiple recipients??

    Hello Experts,
    I got a requirement to send email to multiple recipients. How to approach it as am fairly new to Workflow??
    Thanks & Regards,
    Mohammed.

    Hi,
      Do you only want to send mail using workflow or there any other steps. Then you can directly write the code
    Search in scn you will find lot of post for that
    http://scn.sap.com/thread/3256691

  • Action to send email for multiple recipients

    Hi gurus,
    Currently the user needs to send a email for multiples recipients according to the organization structure.
    For example:
    The user generates a complaint and the systems must notify by email the department responsible to solve this complaint, sending an email for all employees assigned into this organizational unit.
    How should I configure the action to send an email for the whole departament?
    Best Regards,
    Gabriel Santana

    HI Gabriel,
    Get the email ID's of all the recipents from orgunit using FMs <b>RH_STRUC_GET</b> and <b>BAPI_BUPA_ADDRESS_GETDETAIL</b> into internal table <b>et_mailid</b> and then using FM <b>SO_NEW_DOCUMENT_ATT_SEND_API1</b>.
    For reference check the code below:
    <b>*i_message has contents of mail body</b>
    DATA:    g_sent_all(1) TYPE c,
             g_doc_data LIKE sodocchgi1,
      DATA:  i_message      LIKE solisti1   OCCURS 0 WITH HEADER LINE,
             i_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
             i_receivers    LIKE somlreci1  OCCURS 0 WITH HEADER LINE.
    Fill the document data.
        g_doc_data-doc_size = 1.
    Populate the subject/generic message attributes
        g_doc_data-obj_langu = sy-langu.
        g_doc_data-obj_name  = 'SAPRPT'.
        CONCATENATE g_sdltime0(2) ':' g_sdltime2(2) ':' g_sdltime+4(2) INTO g_time.
        CONCATENATE c_subject g_time INTO g_doc_data-obj_descr SEPARATED BY space.
        g_doc_data-sensitivty = 'F'.
    Describe the body of the message
    Information about structure of data tables
        CLEAR i_packing_list.
        REFRESH i_packing_list.
        i_packing_list-transf_bin = space.
        i_packing_list-head_start = 1.
        i_packing_list-head_num = 0.
        i_packing_list-body_start = 1.
        DESCRIBE TABLE i_message LINES i_packing_list-body_num.
        i_packing_list-doc_type = 'RAW'.
        APPEND i_packing_list.
    Add the recipients email address
        LOOP AT et_mailid.
          CLEAR i_receivers.
          i_receivers-receiver = et_mailid-email_id.
          i_receivers-rec_type = 'U'.
          i_receivers-com_type   = 'INT'.
          i_receivers-notif_del  = 'X'.
          i_receivers-notif_ndel = 'X'.
          APPEND i_receivers.
        ENDLOOP.
    Call the FM to post the message to SAPMAIL
        CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
          EXPORTING
            document_data              = g_doc_data
            put_in_outbox              = 'X'
            commit_work                = 'X'
          IMPORTING
            sent_to_all                = g_sent_all
          TABLES
            packing_list               = i_packing_list
            contents_txt               = i_message
            receivers                  = i_receivers
          EXCEPTIONS
            too_many_receivers         = 1
            document_not_sent          = 2
            document_type_not_exist    = 3
            operation_no_authorization = 4
            parameter_error            = 5
            x_error                    = 6
            enqueue_error              = 7
            OTHERS                     = 8.
    Regards,
    Amit
    *Always reward points for helpful answers
    Message was edited by:
            Amit Kumar

  • Send email to multiple recipients

    Hello,
    Does anybody know what the syntax is for sending email to multiple email addresses? Should the email addresses be separated by commas or semi-colons? I can't seem to find an example anywhere and what I've tried doesn't seem to be working, because when I flushed my mail queue, nothing sent out. I know it works with only one address.
    HTMLDB_MAIL.SEND(
    P_TO =>
    Thanks,
    Nora

    Hi nora
    to put multiple address you needs to put a comma between addresses .
    quote from htmldb documentation :
    "Valid e-mail address to which the e-mail will be sent (required).
    For multiple e-mail addresses, use a comma separated list."
    hope that help
    Zvika

  • Behavior of Send Email with Multiple Recipients

    There’s a probable unwanted behavior with the Send Email activity when you have more than 1 recipient.
    If you don’t flatten the the email activity, it acts like a multi-value published data activity and every subsequent activity downstream will trigger as many times as you have recipients
    in the email. I didn't come across this until recently, because sending an email is usually the last thing I do in a runbook.

    i think that might be on purpose, i can see scenarios where that would be useful to process something for each recipient.
    but if you disagree, use http://connect.microsoft.com to post it as a bug, and see what they answer :)
    Best Regards
    Jakob Gottlieb Svendsen
    Trainer/Consultant - Coretech A/S -
    Blog
    MCT - MCTS - VB.NET - C#.NET - Powershell - VBScript Mastering System Center Orchestrator 2012 - 3 day workshop - worldwide training click
    here

  • Trying to send email to multiple recipients but not going through. HELP!!

    When I send via gmail I get an email back saying one or more failed.What is happening with the iPhone?

    The phone is not responsible for the failure. Somewhere in the message you got back, it should detail the REASON that it failed.

  • Mac Lion, how do I send emails to multiple recipients?

    Just upgraded to Lion OS and whilst I like the new email interface, darned if I could get address book to enter multiple recipents without producing a seperate email for each one. Any ideas?

    Yes, I have groups in my old address book which have gone over OK to the new one in Lion but I don't need to send to all of the group!  I used to be able to keep adding names from various groups to make up my required recipients but darned if I have found how I can do it yet in Lion!

  • Error message with a script sending emails to multiple recipients.

    Hi all,
    I am very new with powershell scripting and I want to request your attention and help on this issue.
    I am getting this error message "Send-MailMessage: An invalid character was found in the mail header: ','" given by this script:
    Param (
    [string]$Path = "C:\Temp\",
    [string]$SMTPServer = "smtp.domain1.com",
    [string]$From = "[email protected]",
    [string[]]$To = "[email protected],[email protected]",
    [string]$Subject = "New backup file"
    $SMTPMessage = @{
    To = $To
    From = $From
    Subject = "$Subject at $Path"
    Smtpserver = $SMTPServer
    $File = Get-ChildItem $Path | Where { $_.LastWriteTime -ge [datetime]::Now.AddHours(-6) }
    If ($File)
    { $SMTPBody = "`nThe following files have recently been added/changed:`n`n"
    $File | ForEach { $SMTPBody += "$($_.FullName)`n" }
    Send-MailMessage @SMTPMessage -Body $SMTPBody
    I found the ForEach() approach but when I put it inside I get an infinite loop.
    Many thanks for any suggestions

    [string[]]$To = "[email protected],[email protected]",
    should be
    [string[]]$To = @("[email protected]","[email protected]")

  • 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 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;
    /

  • 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

Maybe you are looking for