|
 |
asp_discuss thread: How to receive e-mail in ASP
Message #1 by "Thang Nguyen" <thangnh_1999@y...> on Sat, 11 Jan 2003 17:41:52
|
|
Hi,
Can you tell me how to write ASP page which can email via Web mail system
(ex Yahoo mail) or POP3 protocol?
Or you can help where to find out find out articles or source code about
receive email in ASP.(No need using COM)
Thank you.
Message #2 by "Chuck" <chuck@c...> on Tue, 14 Jan 2003 16:42:56 -0600
|
|
I've just started learning this myself, but a good start is CDONTS.
<%
Function SendMail
Dim oMail
Set oMail =3D Server.CreateObject("CDONTS.NewMail")
oMail.Send "from@H...","To@t...","My
Subject","This is the body"
End Function
%>
Regards,
Chuck
-----Original Message-----
From: Thang Nguyen [mailto:thangnh_1999@y...]
Sent: Saturday, January 11, 2003 11:42 AM
To: asp_discuss
Subject: [asp_discuss] How to receive e-mail in ASP
Hi,
Can you tell me how to write ASP page which can email via Web mail
system
(ex Yahoo mail) or POP3 protocol?
Or you can help where to find out find out articles or source code about
receive email in ASP.(No need using COM)
Thank you.
Message #3 by kamruz@b... on Wed, 15 Jan 2003 03:26:31
|
|
> Hi,
C> an you tell me how to write ASP page which can email via Web mail
system
(> ex Yahoo mail) or POP3 protocol?
O> r you can help where to find out find out articles or source code about
r> eceive email in ASP.(No need using COM)
T> hank you.
Do you mean you want to send the user an actual ASP page (maybe i read it
wrong!). I don't think this in itself is possible (since ASP is server
side and sending it to the client would make it client side)
You need to send them the HTML, which could be personalised via an ASP
page server side (may mean sending out thousands individually almost, but
hey...)
Here's some code I used for ASPMail component. Tthere's many out there,
you need to find out which one your host uses, but CDONTS is a good place
to start and they're all very similar. Check on sites like webmoney.com,
aspmail.com, 4guysfromrolla.com etc they all have plenty of useful
articles, sorry, don't have urls to hand
hope this is a start at least
Kam :o)
<----------------------------------------------------------------->
s_Mailer = s_Mailer & "<html><head><title>New Order Confirmation</title>"
&vbnewline
s_Mailer = s_Mailer & "<link rel='stylesheet' type='text/css'
href='http://www.mysite.co.uk/stylesheet/style.css'></head>" &vbnewline
s_Mailer = s_Mailer & "<body>" &vbnewline
s_Mailer = s_Mailer & "<table border='0' cellspacing='0' cellpadding='2'
width='580'>" &vbnewline
s_Mailer = s_Mailer & "<tr><td ><img
src='http://www.mysite.co.uk/images/logo.gif' height='50' width='100'
border='0'></td></tr>" &vbnewline
s_Mailer = s_Mailer & "<tr><td valign='top'><b>Company
Name:</b></td><td>" & s_Company_Name & " </td></tr>" &vbnewline
s_Mailer = s_Mailer & "<tr><td valign='top'><b>Company Tel
No:</b></td><td>" & s_Tel_No & " </td></tr>" &vbnewline
s_Mailer = s_Mailer & "<tr><td valign='top'><b>Name:</b></td><td>"
& s_First_name & " " & s_Last_Name & " </td></tr>" &vbnewline
s_Mailer = s_Mailer & "<tr><td
valign='top'><b>Email:</b></td><td>" & s_Email & " </td></tr>"
&vbnewline
s_Mailer = s_Mailer & "<tr><td valign='top'><b>Personal Tel
No:</b></td><td>" & s_Tel_No_Pers & " Ext: " & s_Ext_No
& " </td></tr>" &vbnewline
s_Mailer = s_Mailer & "<tr><td valign='top'><b>Mobile
No:</b></td><td>" & s_Mobile_No & " </td></tr>" &vbnewline
s_Mailer = s_Mailer & "</table>" &vbnewline
s_Mailer = s_Mailer & "</body></html>" &vbnewline
' send email via ASPMail
Dim Mailer
Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
Mailer.FromName = "New Order"
Mailer.FromAddress= "orders@m..."
Mailer.AddRecipient "Kamruz Jaman", "kamruz@b..."
Mailer.AddRecipient "Kamruz (AC2)", "kamruz@a..."
Mailer.RemoteHost = "mrvnet.kundenserver.de"
Mailer.Subject = "New Order Placed From Website"
Mailer.ContentType = "text/html"
Mailer.BodyText = s_Mailer
Mailer.SendMail
Set Mailer = nothing
Message #4 by "Scott Reed" <scottr@m...> on Wed, 15 Jan 2003 10:33:29 -0600
|
|
I'm not sure I totally understand your question but...
If you would like to make an ASP page that sends email,
you need to things....
Form: A form that collects the content of the email.
<form method="POST" action="email.asp">
<p align="left">Your Name:<br> <input type="text" name="USER NAME" size="40"></p>
<p align="left">Your Email:<br> <input type="text" name="USER EMAIL" size="40"></p>
<p align="left">Comments/Questions:<br><textarea rows="12" name="DESCRIPTION"
cols="75"></textarea></p>
<p align="left"><input type="submit" value="Submit" name="B1"></p>
</form>
Script: A small script that sends the email.
<%
body = "Form Field Values" & vbCrLf
'************************
'***Collect the values in the form. You can collect ALL or each one individually.
'************************
For Each obj in request.form
body = body & obj & " : " & request.form(obj) & vbCrLf
Next
body = body & ""
'************************
'***Sends the Email
'************************
Dim objSendMail
Set objSendMail = Server.CreateObject("CDONTS.NewMail")
objSendMail.To ="user@u..."
objSendMail.From ="guest@g..."
objSendMail.Subject = "Subject of email"
objSendMail.Body = body
objSendMail.Send
Set objCDOMail = Nothing
'***********************
'Redirect them to a "Your message has been sent" page.
'***********************
response.redirect "thankyou.asp"
%>
I always add the contents of the form to a database record before sending the
mail. I'm really not aware of any way for an ASP page to Recieve Email.
-Scott
-----Original Message-----
From: Chuck [mailto:chuck@c...]
Sent: Tuesday, January 14, 2003 4:43 PM
To: asp_discuss
Subject: [asp_discuss] RE: How to receive e-mail in ASP
I've just started learning this myself, but a good start is CDONTS.
<%
Function SendMail
Dim oMail
Set oMail = Server.CreateObject("CDONTS.NewMail")
oMail.Send "from@H...","To@t...","My
Subject","This is the body"
End Function
%>
Regards,
Chuck
-----Original Message-----
From: Thang Nguyen [mailto:thangnh_1999@y...]
Sent: Saturday, January 11, 2003 11:42 AM
To: asp_discuss
Subject: [asp_discuss] How to receive e-mail in ASP
Hi,
Can you tell me how to write ASP page which can email via Web mail
system
(ex Yahoo mail) or POP3 protocol?
Or you can help where to find out find out articles or source code about
receive email in ASP.(No need using COM)
Thank you.
Message #5 by "Thang Nguyen" <thangnh_1999@y...> on Wed, 15 Jan 2003 17:30:21
|
|
Thank for your helpings, But my mean is how to configure in my computer
can send and receive mail via Web Interface.
I write a ASP page that it permit user register their email address to get
news monthly.
To test my ASP page correct? I wil run my ASP page in my local machine.
After submit my email (simulate email address that I created ) in
website,I use Outlook Express to see result.
But in Outlook Express no that email. (I never used to Outlook Express to
send or get mail in Internet that I only use to test my application)
I try configured for my Outlook Express and IIS as MSDN (Microsoft)
guided ? But no result? I think I wrong in configure IP Address for
Outlook Express can connect to get mail?
So can you guide me to configure in my local machine? Please write detail
for me ? (Because this is first time I write email application)
I using IIS 5.0 , Win 2000 Pro, IE 5.0.
Thank you.
|
|
 |