IIS and SMTP - send email message with asp

This is Interesting: Free IT Magazines  
Home > Archive > IIS and SMTP > February 2004 > send email message with asp





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author send email message with asp
shaggy

2004-02-27, 1:34 am

I am asking for help from someone who has created an asp page that uses STMP
to send an email message from WinXP Pro/IIS 5. I tried nearly a dozen
examples (including a great one here http://www.sitepoint.com/article/1139 )
but with no luck.

As explained/predicted on many IIS sites - i get a script error when i try
to use CDONTS with WinXP. I did not find anything on TechNet, MSDN or KB
sites that was helpful. Some sites suggest CDOSYS in place of CDONTS but I
did not find an example that works.

I would also be interested in how to make it work on Win Server 2003 as I am
contemplating that "upgrade". I would rather not use a 3rd-party-type
emailer component.

Thanks in advance for any info.




Jeff Cochran

2004-02-27, 10:34 am

On Thu, 26 Feb 2004 22:07:27 -0800, "shaggy" <jimav3@hotmail.com>
wrote:

>I am asking for help from someone who has created an asp page that uses STMP
>to send an email message from WinXP Pro/IIS 5. I tried nearly a dozen
>examples (including a great one here http://www.sitepoint.com/article/1139 )
>but with no luck.


See:

http://www.aspfaq.com/show.asp?id=2119

>As explained/predicted on many IIS sites - i get a script error when i try
>to use CDONTS with WinXP. I did not find anything on TechNet, MSDN or KB
>sites that was helpful.


CDONTS isn't in XP. Kinda causes errors when you try to use it. Use
CDO.SYS.

>Some sites suggest CDOSYS in place of CDONTS but I
>did not find an example that works.


This one works:

http://www.aspfaq.com/show.asp?id=2026

And:

http://www.aspfaq.com/show.asp?id=2339

>I would also be interested in how to make it work on Win Server 2003 as I am
>contemplating that "upgrade". I would rather not use a 3rd-party-type
>emailer component.


Any of the above work.

But, here's the real issue you face:

You are having a problem when using the CDO method. You tell us it
"didn't work". If I told you I had a problem with my car and it
didn't work, would you have the solution readily available?

Post the problem you're having, including specific error messages,
expected and actual results, log entires, event log entries and code
snippets to the ASP group. With that information, someone might be
able to do more than point you to FAQ's. Or at least point you to the
correct FAQ.

By the way, my car didn't work because my wife had the keys. Did my
explanation lead you to that conclusion?

Jeff
shaggy

2004-02-27, 5:34 pm

Here are the specifics on my issue. When I submit the form the following error is displayed:

Error Type:
(0x8004020F)
The event class for this subscription is in an invalid partition
/picks/tuessendmail.asp, line 100

My line 100 reads: objMail.Send

Below is my entire asp page - based on the example at http://www.sitepoint.com/article/1139:

<!--METADATA TYPE="typelib"
UUID="CD000000-8B95-11D1-82DB-00C04FB1625D"
NAME="CDO for Windows 2000 Library" --><!--METADATA TYPE="typelib"
UUID="00000205-0000-0010-8000-00AA006D2EA4"
NAME="ADODB Type Library" --><%
'EMAIL FORM USING CLASSIC ASP AND CDONTS
Dim varName, varEmail, varCompany, varTelephone, varComments, varSend, thisPage
varName = Request.Form("txtName")
varEmail = Request.Form("txtEmail")
varCompany = Request.Form("txtCompany")
varTelephone = Request.Form("txtPhone")
varComments = Request.Form("txtComments")
varSend = Request.Form("send")
thisPage = Request.ServerVariables("SCRIPT_NAME")

If not varSend = 1 Then
'OUTPUT THE CONTACT FORM
%><form action="<%= thisPage %>" method="post"><input type="hidden" name="send" value="1"><p>Feel free to contact us using this web form</p><p>&nbsp;</p><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr valign="top"><td align="right">Name
:</td><td width="3%">&nbsp;</td><td nowrap><input type="text" name="txtName" size="35"></td></tr><tr valign="top"><td align="right">Company:</td><td width="3%">&nbsp;</td><td><input type="text" name="txtCompany" size="35"></td></tr><tr valign="top"><td al
ign="right">email:</td><td width="3%">&nbsp;</td><td nowrap><input type="text" name="txtEmail" size="35"></td></tr><tr valign="top"><td align="right">Telephone:</td><td width="3%">&nbsp;</td><td><input type="text" name="txtPhone" size="25"></td></tr><tr v
align="top"><td align="right">Comments:</td><td width="3%">&nbsp;</td><td><textarea name="txtComments" rows="5"
cols="35"></textarea></td></tr><tr valign="top"><td align="right">&nbsp;</td><td width="3%">&nbsp;</td><td>&nbsp;</td></tr><tr valign="top"><td align="right"><input type="submit"
name="Submit" value="Submit"></td><td width="3%">&nbsp;</td><td><input type="reset" name="Reset"
value="Reset" class="frm"></td></tr></table></form><%
Else

'SEND MAIL AND OUTPUT THANK YOU RESPONSE

'REPLACE LINE RETURNS WITH HTML BREAKS
varComments = Replace(varComments, chr(10), "<br />")

'THE MAIL OBJECT
Dim ObjMail
Set ObjMail = Server.CreateObject("CDO.Message")

Set objConfig = CreateObject("CDO.Configuration")

'Configuration:
objConfig.Fields(cdoSendUsingMethod) = cdoSendUsingPort
objConfig.Fields(cdoSMTPServer) = "localhost"
objConfig.Fields(cdoSMTPServerPort) = 25
objConfig.Fields(cdoSMTPAuthenticate) = cdoBasic

'Update configuration
objConfig.Fields.Update
Set objMail.Configuration = objConfig

objMail.From = varName & " <" & varEmail & ">"
objMail.To = "jimav3@hotmail.com" 'Add your email address
objMail.Subject = "Contact from Your Website"
objMail.HTMLBody = varName & "<br />"_
& VBCrLf & varCompany & "<br />"_
& VBCrLf & varTelephone & "<br />"_
& CBCrLf & varComments & "<br />"
objMail.Send

Set objMail = Nothing
Set objConfig = Nothing

'AND OUTPUT THANK YOU

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

End If

%>



----- Jeff Cochran wrote: -----

On Thu, 26 Feb 2004 22:07:27 -0800, "shaggy" <jimav3@hotmail.com>
wrote:

>I am asking for help from someone who has created an asp page that uses STMP
>to send an email message from WinXP Pro/IIS 5. I tried nearly a dozen
>examples (including a great one here http://www.sitepoint.com/article/1139 )
>but with no luck.


See:

http://www.aspfaq.com/show.asp?id=2119

>As explained/predicted on many IIS sites - i get a script error when i try
>to use CDONTS with WinXP. I did not find anything on TechNet, MSDN or KB
>sites that was helpful.


CDONTS isn't in XP. Kinda causes errors when you try to use it. Use
CDO.SYS.

>Some sites suggest CDOSYS in place of CDONTS but I
>did not find an example that works.


This one works:

http://www.aspfaq.com/show.asp?id=2026

And:

http://www.aspfaq.com/show.asp?id=2339

>I would also be interested in how to make it work on Win Server 2003 as I am
>contemplating that "upgrade". I would rather not use a 3rd-party-type
>emailer component.


Any of the above work.

But, here's the real issue you face:

You are having a problem when using the CDO method. You tell us it
"didn't work". If I told you I had a problem with my car and it
didn't work, would you have the solution readily available?

Post the problem you're having, including specific error messages,
expected and actual results, log entires, event log entries and code
snippets to the ASP group. With that information, someone might be
able to do more than point you to FAQ's. Or at least point you to the
correct FAQ.

By the way, my car didn't work because my wife had the keys. Did my
explanation lead you to that conclusion?

Jeff

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com