November 20th, 2012 12:14 PM
#1
How Do I Get A System Email Sent To Me?
I'm about to add the capability to my app for a user to submit data to a database. The data will be sort of like "sign my guestbook" level but not quite a guestbook. The data will be displayed for all to see. So I want to be sent an email that let's me know that someone submitted data so that I can see what was written almost as soon as it's written so that I can delete it, if need be. I'm using MSSQL 2008 on WinHost, ASP.NET 4.0.
Can someone please give me a rough idea on how to do this and I'll implement it?
November 22nd, 2012 12:59 AM
#2
Re: How Do I Get A System Email Sent To Me?
There are several methods for this...
#1: use the hosting servers SMTP to send the mail (Mail Pickup directory method)...
Code:
Dim ObjSendMail
Dim ObjConfig
Dim Flds
ObjSendMail = Server.CreateObject("CDO.Message")
ObjConfig = CreateObject("CDO.Configuration")
Flds = ObjConfig.Fields
Flds("http://schemas.microsoft.com/cdo/configuration/sendusing") = 1
'----- DBL check path for mail pickup...
Flds("http://schemas.microsoft.com/cdo/configuration/smtpserverpickupdirectory") = "c:\inetpub\mailroot\pickup"
Flds.Update
ObjSendMail.Configuration = ObjConfig
ObjSendMail.To = "email@example.com"
ObjSendMail.Subject = "subject"
ObjSendMail.From = "admin@yourmail.net"
'ObjSendMail.HTMLBody = "this is the body"
ObjSendMail.TextBody = "this is the body"
ObjSendMail.Send
ObjSendMail = Nothing
#2: connection directly to a remote SMTP mail server..
Code:
Dim ObjSendMail
Dim ObjConfig
Dim Flds
ObjSendMail = Server.CreateObject("CDO.Message")
ObjConfig = CreateObject("CDO.Configuration")
Flds = ObjConfig.Fields
Flds.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 '(SMTP).
Flds.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="mail.server.com"
Flds.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
Flds.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False 'Use SSL for the connection (True or False)
Flds.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
' autentication details
Flds.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 'basic (clear-text) authentication
Flds.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") ="yourusername"
Flds.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") ="yourpassword"
Flds.Update
ObjSendMail.Configuration = ObjConfig
ObjSendMail.To = "email@example.com"
ObjSendMail.Subject = "subject"
ObjSendMail.From = "admin@yourmail.net"
'ObjSendMail.HTMLBody = "this is the body"
ObjSendMail.TextBody = "this is the body"
ObjSendMail.Send
ObjSendMail = Nothing
Articles VB6 : Break the 2G limit - Animation 1 , 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
WPF Articles : 3D Animation 1 , 2 , 3
Code snips : VB6 Hex Edit , IP Chat , Copy Prot. , Crop, Zoom : .NET IP Chat (V4) , Adv. ContextMenus , click Hotspot , Scroll Controls
Find me in ASP.NET. , VB6. , VB.NET , Writing Articles , My Genealogy , Forum
All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.
November 22nd, 2012 08:43 AM
#3
Re: How Do I Get A System Email Sent To Me?
these are really good examples... thanks...
Raju2001006
Please put [ CODE][/CODE] tags around your code to preserve indentation and make it more readable...
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
Bookmarks