locked
Using my Hotmail account as the originating point for SQL Server 2005 Database Mail RRS feed

  • Question

  • I'm trying to work through some examples in a SQL Server 2005 book that I have (Mastering SQL Server 2005 by Gunderloy et al.), but to make this managable I really need to get the email notification working.   For the time being, configuring my own SMTP server is quite beyond my capability, but I understand I can use an email address provided by an ISP.   Presumably Hotmail meets this requirement.

    But how do I find out what I need to know about Hotmail?   Specifically, the missing piece is the ID of the outgoing server, and I imagine it's very much an "Internet 101" thing that i can find out easily once I know how.   I did successfully configure a trial copy of Outlook to handle my Hotmail folders, but in that case Outlook simply figured out everything it needed to know based on my email address and the url www.hotmail.com, in a manner that was completely transparent to me.   Or maybe we should say "opaque" when we say "transparent" in computer science, because that's what we really mean.  Smile

    is it possible to do this with Hotmail?   How do I find out the outgoing server name, or even just a static IP address, if it exists?
    Wednesday, November 5, 2008 8:18 PM

Answers

  • For whatever reason, I'm able to get this to work on my Gmail account, but not with Hotmail.   It must be some sort of issue internal to Hotmail, but as long as I know I can get emails from SQL server I'm not worried about this anymore.

    The breakthrough for me was when I downloaded a csharp sample using EASendMail, and found that the same thing applies there.   For some reason, the client will work when I try to use the Gmail server, but not when I use the Hotmail server.   The client program allows you to enter the SMTP server and your usual credentials along with the standard email values (to, subject, text body).   You can also indicate whether you want SSL authentication (yes in this case), but you cannot specify the port number--it defaults to 25.  I was only able to discover that by using the debugger and checking the port setting of the SMTP server object.   I'm sure for anyone who wants to experiment with other ports, it would be easy enough to add a field to the form to allow that to be done.   BTW this usage of port 25 for smtp.gmail.com is not corroborated by the list I linked to above, which says it should be 465.

    If any one is interested in this code the link to it is http://www.emailarchitect.net/webapp/downloads.asp, where you can download a trial copy including the sample app I mentioned (also available in other VS languages).
    Saturday, November 8, 2008 9:15 PM

All replies

  • Usually, you would use your Internet Service Provider's SMTP server for Hotmail - if you google "SMTP Server" along with your ISP's name, you'll probably find it.  It should be documented on their website as well.

     

    Thursday, November 6, 2008 4:06 AM
  • Just on a hunch, I pinged smtp.live.com yesterday and found the Hotmail SMTP server.   Today, acting on your suggestion, I was able to confirm it here.  

    However, I've set up Database Mail to use this outgoing server and the authentication is failing.   The authentication is set up as follows:

    There is only one Profile set up: "hotmail2",

    that contains only one account "Another hotmail account".

    The settings under "Another hotmail account" are as follows:

    Outgoing Mail Server (SMTP)

    Email Address: <myaddress>@hotmail.com
    Display Name: What I want to appear in the From field of the email
    Reply Email: <myaddress as above>@hotmail.com
    Server name: smtp.live.com
    This server requires a secure connection (SSL)    [Checked]
    Port. 25

    SMTP Authentication
    Basic Authentication [Checked]
    Username: <myaddress as above>
    Password <The password I use when logging into Hotmail>

    The error that comes up in the Database Mail log is below.  Earlier, I was getting one that said SSL authentication required, but then I checked the SSL box I mentioned above.

    The error message in the log is now: Message
    The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 4 (2008-11-06T13:50:24). Exception Message: Cannot send mails to mail server. (Mailbox unavailable. The server response was: 5.7.3 Requested action aborted; user not authenticated).
    )

    Also, I tried sending an email to myself, from another ISP, at <myaddress>@smtp.live.com, just to see if that would work outside the confines of SQL Server, and I got this error in the bounce reply:


    Technical details of permanent failure:
    Google tried to deliver your message, but it was rejected by the recipient domain. We recommend contacting the other email provider for further information about the cause of this error. The error that the other server returned was: 530 530 5.7.0 Must issue a STARTTLS command first (state 13).


    It seems to me the errors might be related.   How would I send the starttls command, either in or out of SQL Server?
    Thursday, November 6, 2008 10:42 PM
  • That's more SMTP than I know - you may want to try posting this on an email forum - your issue isn't with SQL Server.

    Friday, November 7, 2008 5:14 AM
  • There was a blog entry on hotmail plus accounts that have smtp access http://mailcall.spaces.live.com/Blog/cns!CC9301187A51FE33!44348.entry . you can check with Hotmail support staff to get the right smtp mail server configuration ( Server, port, SSL required or not, Authentication mechanism). If smtp protocol is supported for your email account, you should be able to use DBMail to send emails through your hotmail's smtp servers

     

     

     

    Thanks

    Sethu Srinivasan

    SQL Server Manageability

    Friday, November 7, 2008 5:55 PM
  • For whatever reason, I'm able to get this to work on my Gmail account, but not with Hotmail.   It must be some sort of issue internal to Hotmail, but as long as I know I can get emails from SQL server I'm not worried about this anymore.

    The breakthrough for me was when I downloaded a csharp sample using EASendMail, and found that the same thing applies there.   For some reason, the client will work when I try to use the Gmail server, but not when I use the Hotmail server.   The client program allows you to enter the SMTP server and your usual credentials along with the standard email values (to, subject, text body).   You can also indicate whether you want SSL authentication (yes in this case), but you cannot specify the port number--it defaults to 25.  I was only able to discover that by using the debugger and checking the port setting of the SMTP server object.   I'm sure for anyone who wants to experiment with other ports, it would be easy enough to add a field to the form to allow that to be done.   BTW this usage of port 25 for smtp.gmail.com is not corroborated by the list I linked to above, which says it should be 465.

    If any one is interested in this code the link to it is http://www.emailarchitect.net/webapp/downloads.asp, where you can download a trial copy including the sample app I mentioned (also available in other VS languages).
    Saturday, November 8, 2008 9:15 PM
  • This is very useful information, Pith, because I'm doing much the same thing.  Thank you very much for posting this!

     

     

    Saturday, November 15, 2008 2:43 PM
  • Hi,
    Did you say you got gmail working with DBMail? I can't get it to work... Would anyone know what the problem is?
    Here are my settings:


    Outgoing Mail Server (SMTP)

    Email Address: <myaddress>@gmail.com
    Display Name: What I want to appear in the From field of the email
    Reply Email: <myaddress as above>@gmail.com
    Server name: smtp.gmail.com
    This server requires a secure connection (SSL)    [Checked]
    Port. 587

    SMTP Authentication
    Basic Authentication [Checked]
    Username: <myaddress as above>
    Password <The password I use when logging into Gmail>



    I am really at a loss why it fails.... I have created a public profile that associates to that mail account...

    The error is the following:
    The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 1 (2008-12-05T18:02:41). Exception Message: Cannot send mails to mail server. (The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required.

    Any help would be really appreciated!!
    Friday, December 5, 2008 11:15 PM
  • Hi Amy,

    The problem you are experiencing with your GMAIL account with DBMail on SQLServer is the requirement of STARTTLS.  GMAIL requires that STARTTLS=1 and using SSL authentication isn't going to get you there.

    I am trying to solve the same issue for GMAIL but so far no luck either.

    Thursday, January 22, 2009 4:33 AM
  • FWIW, I managed to get Hotmail to work with Database Mail. I'm on the road now, so I don't have the details but it involved 2 things (out of the ordinary):

    Upgrading to a pay-account (hotmail plus or whatever it is called).
    Changing port number for SMTP server.

    I really wanted this for my NAS to be able to send email, but i found it easier to test and troubleshoot using Database Mail. I finally got it working with Database Mail, so I could use the same basic config in my NAS device.

    Ahh, hang on. I have saved a screen shot of my NAS device SMTP config. Seems I'm using port number 587 (something I've found out by Googling).
    Tibor Karaszi
    Thursday, January 22, 2009 8:32 AM