Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Send email noticfication using ASP

Status
Not open for further replies.

heyhey84

Programmer
Aug 31, 2003
16
SG
I am doing a project using ASP.
i want to send a email noticefication when a user register.But i do not know how to do it.

Can anyone help?
 
You can search for CDONTS(default windows mailer) or kook for JMail free mailer component(this one should be better)

a little example

dim objMail
set objMail = Server.CreateObject("CDONTS.Newmail")
objMail.From = "from@server.com"
objMail.To = "to@server.com"
objMail.Subject = "Server notification!"
objMail.MailFormat = 0
objMail.BodyFormat = 0
objMail.Body = "This is a notification"
objMail.Send
set objMail = nothing


________
George, M
 
[tt]I'm going to assume you already know how to populate the database with ppl that register. (Or maybe I shouldn't?)

this links shows you the basic process:


let me know if you would like more detailed information

[tt]

buffalo.gif height="73px" width="43px"

 
Hi DeCojute,

I do know how to capture the registration info into the database.

ya i do need more detail, i am using win XP. And i do not have a sever.

can i still able to send email noticefication?
 
[tt]If you have XP Home it's going to take some manipulating of your system (don't know how much of that you want to do) but if you have XP Pro, it comes with a full IIS server capabilities and with XP Pro you can email but again more changes will have to be made.

[tt]

buffalo.gif height="73px" width="43px"

 
Hi DeCojute,

ya i am using win xp pro.
i installed the IIS.
Can u tell me in more detail wat i should do?

Do u have msn messager? so we can communicate better.
 
[tt]Nope, sorry I don't use messengers at all. (take too much of my daily duties).
--------------------------------------------------------

Let's start with the basics
1. Upon your users registering submit the form to a script page looking something like this:

<%
Dim objMail
Set objMail = Server.CreateObject(&quot;CDONTS.NewMail&quot;)

objMail.From = &quot;YOU@ISP.COM&quot;
objMail.Subject = &quot;Thanks for registering to my site&quot;
objMail.To = Request.form(&quot;USERS_EMAIL_FORM_FIELD&quot;)
objMail.Body = &quot;This is an email message&quot; & vbcrlf&_
&quot;with CDONTS.&quot; & vbcrlf&_
&quot;It is really easy. &quot;
objMail.Send

Response.write(&quot;Mail was Sent&quot;)

'You must always do this with CDONTS.
set objMail = nothing
response.redirect &quot;Your_site.com&quot;
%>


The blue line above represents the variable from the email text field on the form.

Does this make sense?

---------------------------------------------------------

Information on XP Pro changes for sending CDONTS emails


[tt]

buffalo.gif height="73px" width="43px"

 
I have this error,

Error Type:
Server object, ASP 0177 (0x800401F3)
Invalid class string

which is -> Set objMail = Server.CreateObject(&quot;CDONTS.NewMail&quot;)

dont i need a mail server?
i do not understand how the email will be able to send out.
 
[tt]Also check this FAQ: faq333-2962

[tt]

buffalo.gif height="73px" width="43px"

 
Hi DeCojute,
my error is ->CDO.Message.1 (0x80040213)
The transport failed to connect to the server.
How to solve this problem?
i dont have a sever .

my coding is
######################################################

<!--METADATA TYPE=&quot;typelib&quot;
UUID=&quot;CD000000-8B95-11D1-82DB-00C04FB1625D&quot;
NAME=&quot;CDO for Windows 2000 Library&quot; -->
<!--METADATA TYPE=&quot;typelib&quot;
UUID=&quot;00000205-0000-0010-8000-00AA006D2EA4&quot;
NAME=&quot;ADODB Type Library&quot; -->


<%


Dim ObjMail
Set ObjMail = Server.CreateObject(&quot;CDO.Message&quot;)
Set objConfig = CreateObject(&quot;CDO.Configuration&quot;)


objConfig.Fields(cdoSendUsingMethod) = cdoSendUsingPort
objConfig.Fields(cdoSMTPServer) = &quot;localhost&quot;
objConfig.Fields(cdoSMTPServerPort) = 25
objConfig.Fields(cdoSMTPAuthenticate) = cdoBasic


objConfig.Fields.Update
Set objMail.Configuration = objConfig


Dim VarName,varEmail,varCompany,varTelephone,varComments

varName=&quot;Mr lee&quot;
varEmail=&quot;abc@abc.com&quot;
varCompany=&quot;abc&quot;
varTelephone=&quot;123&quot;
varComments=&quot;hello&quot;

objMail.From = varName & &quot; <&quot; & varEmail & &quot;>&quot;
objMail.To = &quot;your-name@your-website.com&quot;
objMail.Subject = &quot;Contact from Your Website&quot;
objMail.HTMLBody = varName & &quot;<br />&quot;_
& VBCrLf & varCompany & &quot;<br />&quot;_
& VBCrLf & varTelephone & &quot;<br />&quot;_
& CBCrLf & varComments & &quot;<br />&quot;

objMail.Send

Set objMail = Nothing



Response.Write &quot;Hey &quot;& varName & &quot;,<br />&quot;_
& VBCrLf & &quot;Thanks for your feedback.<br />&quot;_
& VBCrLf & &quot;We’ll contact you as soon as possible!&quot;



%>

###########################################################
 
[tt]but you said this on your third post

&quot;ya i am using win xp pro.
i installed the IIS.&quot;

See if shaddow's suggestion helps you
 
i thought now my problem is that i cant connect to the STMP server?

objConfig.Fields(cdoSMTPServer) = &quot;localhost&quot;

localhost is it correct?

i do not know my valid STMP server
 
[tt]Try using CDO to send the email
i.e.
Dim obCDO
Set obCDO = Server.CreateObject(&quot;CDO.message&quot;)
with obCDO
.From = &quot;you@Your.isp&quot;
.To = &quot;user@isp.com&quot;
.Subject = &quot;thank you&quot;
.TextBody = &quot;blah blah&quot;
.Send()
end with
 
Hi DeCojute ,

i had change my OS to win 2k. and it work perfectly fine.

but y winxp got problem?
 
[tt]Glad to hear you got it working [thumbsup2]

win xp pro made some changes with their components where one must installed a new component to use cdonts etc... too much to get into. Glad you worked it out.

[tt]

buffalo.gif height="65px" width="38px"

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top