Sending mail through SQL server 2000 with ASP

  • Hello!

    This is my first post and may be a bit off-topic, but i hope you can still help me.

    So the situation is, that I want to send mail with ASP code.

    I have all the subject,message, email-addresses etc. stored in the database ( SQL Server 2000 Enterprise) and now I am wondering how can I send that data with forward? Can I use SQL_Mail some how here?

  • I don't know about ASP, but with Access I can use VB to enter my parameters and execute my mail procedure from a form. I use one called send_cdosysmail, but I see a lot of folks here using xp_sendmail. As long as you have all your ducks lined up in a table it should be no different from executing any other procedure from your app.

    Greg

    Greg
    _________________________________________________________________________________________________
    The glass is at one half capacity: nothing more, nothing less.

  • How do you trigger the mail / how do you assign, for example, the To field with Access? I bet the commands are quite similar.

  • ilhuhtin (11/14/2007)


    How do you trigger the mail / how do you assign, for example, the To field with Access? I bet the commands are quite similar.

    For most of the emails I have made an email staging table containing fields for all the stuff necessary to send an email, including a delivery_dt and sent_dt column. I have triggers on various tables that populate the email staging table, then most of them get sent via a job at night. For ones here and there, however, I have a form that looks like an email template, with text boxes for the To, Cc, From, Subject, and Body fields. Then, when I fill out the form those values are passed as the parameters needed for my email procedure when I hit the send button. The send button has an on click event, basically like follows.

    Dim strSQL as String

    strSQL = 'EXECUTE send_cdosysmail '" & me.txtTo & "', '" & me.txtFrom & "',...

    DoCmd.RunSQL strSQL

    you get the idea if you know Access. Very simple.

    If you know how to pass parameters to SQL Server from .ASP ( I don't), then once you set up your email procedure it should be no problem.

    Greg

    P.S. What I should have included in the above is that I have a users table, so whenever I add a login I enter it in the users table that has the first name, last name, login_nm (master.sysxusers.name) and email. That way, if a table houses information that may require email notification, I add column entered_by default system_user, and my trigger can populate the email staging table with the users email address as the to field.

    Greg
    _________________________________________________________________________________________________
    The glass is at one half capacity: nothing more, nothing less.

  • Excelent, that seems quite simple. I will try this tonight.

    Thanks alot!

  • If your ASP page is 2.0 then you may want to look at

    Imports System.Net.Mail

    Start with

    Dim message As MailMessage = New MailMessage


    MISfIT

  • Aye, got it working. Thanks a lot for the help!

Viewing 7 posts - 1 through 6 (of 6 total)

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