Results 1 to 7 of 7
  1. #1
    Join Date
    Feb 2005
    Posts
    30

    Unanswered: Sending email without using Database Mail

    I have a website that I want to put a contact form on so I can allow users to send emails from it. I have SQL Server as my db but my hosting co. won't allow me to use the Database Mail procedure to send emails (msdb.dbo.sp_send_dbmail I think it's called).
    I will have to write my own procedure to do it instead. Can anyone point me in the direction of some good resources where I might get some info on how to do this?

  2. #2
    Join Date
    Sep 2003
    Location
    New York, NY
    Posts
    136
    if your hosting service isn't allowing database email then even if you write your own procedure it wont work.
    try exploring the mail setup your hosting service has and use front end code to send emails.

  3. #3
    Join Date
    Jun 2004
    Location
    Long Island
    Posts
    696
    sendemail.exe, works good for me, use in in .cmd file wrappers for DTS runs, batch runs, osql calls, etc.

    copy it to c:\windows\

  4. #4
    Join Date
    Nov 2005
    Posts
    122
    The only other option would be to create a CLR procedure, but I'm pretty sure your host won't allow you to do this because it will require EXTERNAL_ACCESS (or even UNSAFE, not quite sure) for the CLR procedure.

    So you're left with two options. Find a host that allows use of sp_send_dbmail or host the web site yourself.

  5. #5
    Join Date
    Feb 2005
    Posts
    30
    Quote Originally Posted by rohitkumar
    if your hosting service isn't allowing database email then even if you write your own procedure it wont work.
    try exploring the mail setup your hosting service has and use front end code to send emails.
    Yeah, you are right, writing my own sproc won't work. I am going to use back end code (C#) to do it as my site is ASP.NET with C# as the code behind.
    I'd rather do it as a stored procedure but ah well. I am using Ajax to call the C# code so it's still impressive enough I suppose.

    Quote Originally Posted by kaffenils
    The only other option would be to create a CLR procedure, but I'm pretty sure your host won't allow you to do this because it will require EXTERNAL_ACCESS (or even UNSAFE, not quite sure) for the CLR procedure.

    So you're left with two options. Find a host that allows use of sp_send_dbmail or host the web site yourself.
    Thanks kaffenils, I tried a CLR procedure already but as you correctly point out that doesn't work on the host either. I won't change to a different hosting co. just 'cause of that though, it's only a small part of the site.
    I'd like to host it myself but I don't have a server lying around!

  6. #6
    Join Date
    Nov 2006
    Location
    Quebec
    Posts
    172
    If you are using MSSQL for your website, this means your server is probably IIS,

    If it's the case you should use ASP to send your e-mails.

    I use apache and php so I can't help you with ASP but google it a bit and you'll find a way.

    Regards

    Or Tho
    Less is more.
    How long is now?
    http://www.lesouterrain.com

  7. #7
    Join Date
    Feb 2005
    Posts
    30
    Quote Originally Posted by ortho
    If you are using MSSQL for your website, this means your server is probably IIS,

    If it's the case you should use ASP to send your e-mails.

    I use apache and php so I can't help you with ASP but google it a bit and you'll find a way.

    Regards

    Or Tho
    I haven't put the contact form up live yet but it's working fine on my local machine. I use the C# namespace System.Net.Mail for it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •