Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 25th, 2007, 07:02 PM
Authorized User
 
Join Date: Feb 2007
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default aspMail

 I am having trouble using aspMail in my asp site.

The main language of the site is JScript and I am trying to re-use some code for aspMail (VBScript) as I have run out of time to look and create a JScript equivalent (due Monday at midnight):

I have a connect.asp file which contains this code:

Code:
<%@ LANGUAGE="JAVASCRIPT" %>
<%
myconn=Server.CreateObject("ADODB.connection");
mydb = "Driver={Microsoft Access Driver (*.mdb)};DBQ=e:\\webareas\\mg511\\SHIC\\shic.mdb";

myconn.Open (mydb);
rs = Server.CreateObject("ADODB.Recordset");
%>
I have this code for the aspMail:
Code:
<%
<SCRIPT LANGUAGE="VBScript" RUNAT="Server">
Set Mail = Server.CreateObject("Persits.MailSender")
Mail.Host = "smtp.gre.ac.uk"
Mail.FromName = request("nameBox")
Mail.From = request("emailBox")
Mail.AddAddress request ("emailhidden")
Mail.Subject = "Enquiry Confirmation"
Mail.IsHTML = True
Mail.Body = "<html><body><b>Name: </b> "& request ("nameBox") &"<br /><b>Requested Event: </b>"& request ("select") &" <br /><b> Email:</b> "& request ("emailBox") &" <br /><b> Telephone:</b> "& request ("telephoneBox") &"</body></html>"

Mail.Send

%>
The problem is that the server is expecting JScript code, can as such does not run the aspMail page correctly.

Heres a link to the problem: http://cms-stu-iis.gre.ac.uk/mg511/S...asp?memberid=4

Any help would be greatly appreciated

Thanks in advance
Graham


 
Old February 26th, 2007, 02:14 AM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

Have you thought about using CDOSYS? This is reccomended and the most problem free mail method

A working sample:

<!--
Sending SMTP mail via port 25 using CDOSYS This ASP page
uses CDOSYS to send SMTP mail using port 25 of the SMTP
server that is set. The e-mail delivery is handled by the
SMTP server that is set in the configuration object.
-->
<%
Const cdoSendUsingPort = 2
Dim iMsg,iConf,Flds,strHTML,strSmartHost
StrSmartHost = "your mail IP"
set iMsg = CreateObject("CDO.Message")
set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields

'set the CDOSYS configuration fields to use port 25 on the SMTP server
With Flds
   .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort
   .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strSmartHost
   .Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 10
   .Update
End With

'apply the settings to the message
With iMsg
   Set .Configuration = iConf
   .To = "someEmailAddress"
   .From = "someOtherEmailAddress"
   .Subject = "someSubject"
   .HTMLBody = "Sent using CDOSYS..."
   .Send
End With

' cleanup of variables
Set iMsg = Nothing
Set iConf = Nothing
Set Flds = Nothing

%>

Wind is your friend
Matt
 
Old February 26th, 2007, 06:24 AM
Authorized User
 
Join Date: Feb 2007
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default

OK, i am assuming that this is in VBScript! Am I correct in that assumtion?

 
Old February 26th, 2007, 06:51 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

Yes indeed.

If you are using a Windows 2000 / 2003 Server, or even XP Pro chances are that CDOSYS is your best
bet for sending email from ASP. That is because CDOSYS is installed on all of them
by default. Gone are the days of using CDONTS which was the old way of sending email from ASP.
CDOSYS is it's replacement. NOTE: The CDONTS .dll is no longer shipped nor supported by MS


Wind is your friend
Matt





Similar Threads
Thread Thread Starter Forum Replies Last Post
aspMail Morn ASP.NET 2.0 Basics 1 February 25th, 2007 09:40 PM
ASPMail embaded images kalpitkk Classic ASP Professional 1 January 9th, 2006 01:06 PM
ASpMail chocobabe100 Classic ASP Basics 1 May 5th, 2005 11:27 PM
ASPMail / Shift_JIS jz552 Classic ASP Professional 0 May 4th, 2005 02:39 PM
AspMail mmarkym Classic ASP Components 2 December 21st, 2003 01:36 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.