How to check whether email was sent to GMAIL account ?

  • We have a sqL job that calls a C#program ( executable ). That executable creates a PDF also sends out an email.

    Everything is fine except that we have no way o know whether the job is running every 5 minutes or has got stalled.

    So I plan to recreate the executable to send out an email to a GMAIL account everyday.

    Then I can check the GMAIL account ( via -Tsql ) to see whether it received a new email.

    Can anyone help me with the code part for connecting to GMAIL.COM ( I mean doing a remote login via SQL code )

  • SQL server cannot connect to a POP3/IMAP a server to pull down the mail natively.

    you can do it in a programming language like c#/VB.net, which also means you can create a Common Language Runtime(CLR) to do the same.

    the code that sends the email in the c# app could capture the return code from the mail server, so you know if any error was returned, like Error 5.7.1 relaying prohibited is returned or whatever. so you can capture it at the moment of sending right there.

    you can use google as the SMTP server to send outbound mail, but you cannot check the mailbox.

    sending email is a different animal, and i just mention it to be complete.

    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!

  • That's not a T-SQL question.

    "Do not seek to follow in the footsteps of the wise. Instead, seek what they sought." - Matsuo Basho

  • All you can do is see if the message was qqueued for send here

    select * from msdb.dbo.sysmail_mailitems

    See in this table if it has info you could use.

    Further than that, as everyone else said.

    Catch-all queries done right [/url]
    Gail Shaw's Performance Blog[/url]

Viewing 4 posts - 1 through 3 (of 3 total)

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