Sending email from SQL

  • Hi all,

    I am having trouble in sending email from db. I am not able to send emails to yahoo or gmail or any other domain. I am able to send to emails to my office domain. when i checked the entry in the table ,status is sent failed .

    Kindly help us

    Regards,

    Devanand.

  • Have you checked with your mail administrators that you can actually send to an outside domain?

  • This sounds like a bounceback from your mail server, check with your sys admins that you can send e-mail to an external domain.

    ---

    Note to developers:
    CAST(SUBSTRING(CAST(FLOOR(NULLIF(ISNULL(COALESCE(1,NULL),NULL),NULL)) AS CHAR(1)),1,1) AS INT) == 1
    So why complicate your code AND MAKE MY JOB HARDER??!:crazy:

    Want to get the best help? Click here https://www.sqlservercentral.com/articles/forum-etiquette-how-to-post-datacode-on-a-forum-to-get-the-best-help (Jeff Moden)
    My blog: http://uksqldba.blogspot.com
    Visit http://www.DerekColley.co.uk to find out more about me.

  • Hi ,

    Thanks for the reply .Can u tell me how to check it.

    Regards,

    Devanand

  • I'm afraid I have no idea, I'm not a server admin.

    ---

    Note to developers:
    CAST(SUBSTRING(CAST(FLOOR(NULLIF(ISNULL(COALESCE(1,NULL),NULL),NULL)) AS CHAR(1)),1,1) AS INT) == 1
    So why complicate your code AND MAKE MY JOB HARDER??!:crazy:

    Want to get the best help? Click here https://www.sqlservercentral.com/articles/forum-etiquette-how-to-post-datacode-on-a-forum-to-get-the-best-help (Jeff Moden)
    My blog: http://uksqldba.blogspot.com
    Visit http://www.DerekColley.co.uk to find out more about me.

  • Let me check with him and will get back.

    Devanand.

  • As derek and anthony identified, it'll be an issue with your mail server not allowing relaying; it's an anti spam feature.

    relaying is forwarding/sending emails to a domain outside of the mail server

    most servers are set up to allow anonymous relaying only from the LAN or specific ip addresses; that's where your mail admin comes in to add the web server or machine that is trying to relay.

    most servers will allow relaying if you AUTH via basic authenticationwith a username and password, instead of anonymous.

    if you look at you profile, do you have info for the username and password, or did you select anonymous?

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • Hi,

    Thanks for the reply. I looked into the profile configration we have set basic authentication and we have given the credentials.

    Is that the reason for undelivered?

    Devanand.

  • devanandiiway (8/6/2012)


    Hi,

    Thanks for the reply. I looked into the profile configration we have set basic authentication and we have given the credentials.

    Is that the reason for undelivered?

    Devanand.

    can't say for sure; relaying is what the issue seems to be.

    if you run this query, what are the specific error messages? they should tell you exactly what is not working; with the specific errors, we could tell you more.

    SELECT

    err.[description],

    fail.*

    FROM [msdb].[dbo].[sysmail_event_log] err

    inner join [msdb].[dbo].[sysmail_faileditems] fail

    ON err.mailitem_id = fail.mailitem_id

    for example, port 25 traffic is blocked at my job as a security lockdown; so when i send to gmail or any other address from a dev machine, i got this error:

    The mail could not be sent to the recipients because of the mail server failure.

    (Sending Mail using Account 1 (2011-03-03T08:42:29). Exception Message: Could not connect to mail server.

    (No connection could be made because the target machine actively refused it 209.190.184.120:825). )

    after a firewall change to add my dev machine to the list of exceptions, i can send via database mail.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • This is the error msg I am getting "The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 1 (2012-08-06T05:26:52). Exception Message: Cannot send mails to mail server. (Mailbox unavailable. The server response was: 5.7.1 Unable to relay). )"

  • In addition to the last reply I just want to tell that I changed the SMTP authentication to Anonyms but i didn't worked.

  • back to the first suggestions: get with your mail administrator; tell him the IP address /machine name and account you are trying to use so he can allow relaying.

    after he puts the changes in place, try to test the mail again against outside email addresses.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • Thanks Lowell. I will check with him and post the thing what has been blocking.

    Thanks again,

    Devanand.

Viewing 13 posts - 1 through 12 (of 12 total)

You must be logged in to reply to this topic. Login to reply