|
-
September 30th, 2002, 10:01 AM
#1
sending mail from ASP.net
HI all
i MADE A REGISTRATION FORM VIA asp.nET AND i SAVE MY DATA INTO A DATABASE IN SQL SERVER
i NEED TO SEND AN EMAIL TO ADMINISTRATOR EACH TIME A NEW RECORD INSERTED TO THE DATABASE
THANKS
-
September 30th, 2002, 07:15 PM
#2
heres an example in C#
Code:
private void SomeFunction()
{
// Insert Record into DataBase
// Generate the body of the email
string sBody = "A new record has been inserted";
// Send the Email
System.Web.Mail.MailMessage msg = new System.Web.Mail.MailMessage();
msg.BodyFormat = System.Web.Mail.MailFormat.Html;
msg.From = sFromEmail;
msg.To = sToEmail;
msg.Subject = sSubject;
msg.Body = sBody;
System.Web.Mail.SmtpMail.Send(msg);
}
Matt
-
October 19th, 2002, 05:30 PM
#3
Best way to do it is setup a TRIGGER in the database.
You can setup an AFTER OF INSERT trigger to send an email to the administrator each time a record is sucessfully inserted in the database.
Using triggers email will be generated any time a record is inserted, regardless of how was inserted.
I hope this helps.
Sidney Orret
-
October 20th, 2002, 09:38 AM
#4
would you please tell me how can I do that
-
November 3rd, 2002, 10:49 AM
#5
when I try this it sends to all the mail inside the domain but it does not send to any mail such as yahoo or hotmail
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|