14 Replies Latest reply on Mar 6, 2008 6:58 PM by Billy~Verreynne

    Reg.SMTP Error while using UTL_MAIL in Oracle 10g

    626103
      Hi,

      I am getting the following SMTP error while trying to use the UTL.MAIL package of Oracle 10g. The query is as follows.

      begin
      utl_mail.send(
      sender => 'NAVEEN',
      recipients => 'naveenkumar.c@tatatel.co.in',
      subject => 'Testing utl_mail',
      message => 'The receipt of this email means'|| ' that UTL_MAIL works'
      );
      end;

      UTL_MAIL package is installesd and the port 25 is configured and firewall is changed.
      The same block was working fine before 5 days and now is giving the error as

      ORA-29279: SMTP permanent error: 501 badly formatted MAIL FROM user - no "<"
      ORA-06512: at "SYS.UTL_SMTP", line 21
      ORA-06512: at "SYS.UTL_SMTP", line 99
      ORA-06512: at "SYS.UTL_SMTP", line 222
      ORA-06512: at "SYS.UTL_MAIL", line 407
      ORA-06512: at "SYS.UTL_MAIL", line 594
      ORA-06512: at line 2

      Could you please help me out how to proceed???

      Regards,
      Naveen Kumar.
        • 1. Re: Reg.SMTP Error while using UTL_MAIL in Oracle 10g
          Satish Kandi
          Did you read the documentation completely?

          http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/u_mail.htm#i1001258

          states

          sender The email address of the sender.

          You have written

          sender => 'NAVEEN',
          • 2. Re: Reg.SMTP Error while using UTL_MAIL in Oracle 10g
            626103
            Hi Satish,

            Thanks for your reply. I have gone through the documentation also. Irrespective of validity of sender's email adress, UTL_MAIL was working. But we need to give any varchar type of input.Even if I changed the sender's email to a valid email address, the same problem is persisting. Could you help me in this regard........

            Reards,
            Naveen
            • 3. Re: Reg.SMTP Error while using UTL_MAIL in Oracle 10g
              CraigB
              Naveen,
              I've used UTL_SMTP and UTL_MAIL quite a bit and have never been able to use a SENDER address that is not a valid email address "FORMAT". So long as the format of the email address conforms to the standard email format, "Name@domain.com" it will work. How you have been able to make it work in the past is a mystery. If you do not want the Sender or From address to be from a valid email address, that's fine, but at least use a valid email address format; eg: abc@abc.com. This is the cause of you error.

              Craig...
              • 4. Re: Reg.SMTP Error while using UTL_MAIL in Oracle 10g
                519688
                actually, it can work - depending on your mail provider/server. in my local database, I use my ISPs mail server as my utl_stmp_server. and since my email address is MYNAME@THEIR_SERVER, I can send via utl_mail just using MYNAME as the sender. of course, the reciepient sees the sender as MYNAME@mta.srv.hcvlny.cv.com (or some other random crap).
                • 5. Re: Reg.SMTP Error while using UTL_MAIL in Oracle 10g
                  626103
                  craig,

                  I have used the valid email format also. but still I am getting the error as

                  ORA-29279: SMTP permanent error: 501 badly formatted MAIL FROM user - no "<"

                  I could not find much info regarding this error .Can anyone help me out ???

                  Regards,
                  Naveen
                  • 6. Re: Reg.SMTP Error while using UTL_MAIL in Oracle 10g
                    519688
                    just for laughs, try formatting the addresses like this

                    sender => 'naveen <naveen@mailserver.com>'

                    perhaps there's some weird setting on your mail server whcih requires the email alias. it could explain why it used to work, but now doesn't - someone in the mailroom has been screwing around.
                    • 7. Re: Reg.SMTP Error while using UTL_MAIL in Oracle 10g
                      626103
                      Shoblock,

                      sender => 'naveen <naveen@mailserver.com>' is also giving the same error.I have also tried with other email IDs also, but it didn't work. I could not get any information why
                      'ORA-29279: SMTP permanent error: 501 badly formatted MAIL...' error comes.

                      Regards,
                      Naveen
                      • 8. Re: Reg.SMTP Error while using UTL_MAIL in Oracle 10g
                        Satish Kandi
                        This looks like a SMTP configuration issue. Check metalink doc 406256.1

                        HTH...
                        • 9. Re: Reg.SMTP Error while using UTL_MAIL in Oracle 10g
                          JustinCave
                          This error is coming from your mail server.

                          You may want to have a chat with your mail server administrator to see what sort of validation they're doing on the from address. That's probably more efficient than just trying to guess at a valid format.

                          Justin
                          • 10. Re: Reg.SMTP Error while using UTL_MAIL in Oracle 10g
                            626103
                            Thanks for all for your suggestiona. Actually, we have raised an SR and came to know that there is a BUG in Oracle regarding UTL_MAIL which resulted in the mentioned error .
                            • 11. Re: Reg.SMTP Error while using UTL_MAIL in Oracle 10g
                              Billy~Verreynne
                              Can you back that statement about an Oracle UTL_SMTP bug up with an actual bug number??

                              From what you have posted, this is not a bug!! but expected and documented (RFC'ed) SMTP server behaviour.

                              My proof:

                              /home/billy> telnet mail 25
                              Trying 165.143.128.26...
                              Connected to mail
                              Escape character is '^]'.
                              220 CNTRRA20-GTW01 [CNTRRA20-GTW01] Thu, 06 Mar 2008 14:26:26 +0200
                              HELO 10.251.93.58
                              250 CNTRRA20-GTW01 Hello [10.251.93.58]
                              MAIL FROM: naveen <naveen@mailserver.com>
                              501 naveen <naveen@mailserver.com> : illegal character(s) in domain string
                              MAIL FROM: NAVEEN
                              501 NAVEEN : domain string is NULL.
                              quit
                              221 CNTRRA20-GTW01 closing connection. Goodbye!
                              Connection closed by foreign host.
                              /home/billy>
                              As you can clearly see, the SMTP server expects a DOMAIN name as part of the MAIL FROM address. It also does not accept the alternative format suggested.

                              Yes, not all SMTP servers are equal and some support additional formatting.

                              But to imply that because the SMTP server does not accept your address formatted as string NAVEEN, it is a UTL_SMTP problem, sounds like a smelly one to me.
                              • 12. Re: Reg.SMTP Error while using UTL_MAIL in Oracle 10g
                                Billy~Verreynne
                                And yes, I did see you referred to UTL_MAIL as having the so-called bug and I responded that UTL_SMTP does not have a bug.

                                The reason is that UTL_MAIL is very specific in what parameters it accepts. It well documented in the [url http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/u_mail.htm#i1001699]Oracle® Database PL/SQL Packages and Types Reference guide.

                                It states that the sender parameter is:

                                sender The email address of the sender.
                                (Note is does not say "alias" and "I will append the domain for you - it states in black and white it wants the *email address*)

                                The definition of an e-mail address is the identification of a unique e-mail account (e.g. POP3 or IMAP) at a domain, and is specified in the format:
                                <accountname>@<domainame>

                                Your code is clearly violating this standard.. not using UTL_MAIL correctly, obviously causing UTL_SMTP to pass an invalid formatted address.. and despite this, you insist that you have (according to your so-called SR report feedback) uncovered a bug in Oracle UTL_MAIL/UTL_SMTP?

                                I find that very hard to believe.
                                • 13. Re: Reg.SMTP Error while using UTL_MAIL in Oracle 10g
                                  CraigB
                                  Naveen,
                                  I have seen situations where an email address was considered malformed because it did not include the <> around the address. I didn't notice this in your original posting until just now: "501 badly formatted MAIL FROM user - no "<"." Try adding these characters to your
                                   sender => '<NAVEEN>'; 
                                  statement.

                                  Craig...
                                  • 14. Re: Reg.SMTP Error while using UTL_MAIL in Oracle 10g
                                    Billy~Verreynne
                                    Craig, your premise is that the SMTP server will accept a MAIL FROM format is is not the standard.

                                    Not saying that some SMTP servers will not perhaps accept this and append the default domain to it.. but I want to make it absolutely clear in this thread that what the SMTP server accepts or rejects (as the MAIL FROM address) has absolutely nothing to do with ULT_MAIL or UTL_SMTP.

                                    It is an issue between you, the person/developer that selected that specific (failed) address format and the SMTP server that may or may not accept it.

                                    Calling it a bug in UTL_SMTP/UTL_MAIL is in my view, simply not acceptable in this case.