Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: RE: ASP and sending email through SMTP MDaemon Mail Server


Message #1 by "Carl E. Olsen" <carl-olsen@m...> on Sun, 1 Sep 2002 17:49:23 -0500
This code seems to work better:

<%
' Send by connecting to port 25 of the SMTP server.
Dim iMsg 
Dim iConf 
Dim Flds 
Dim strHTML

Const cdoSendUsingPort = 2

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") 
<"SMTP server"> 
 
.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontime
out") = 10  
    .Update
End With

' Build HTML for message body.
strHTML = "<HTML>"
strHTML = strHTML & "<HEAD>"
strHTML = strHTML & "<BODY>"
strHTML = strHTML & "<b> This is the test HTML message body</b></br>"
strHTML = strHTML & "</BODY>"
strHTML = strHTML & "</HTML>"

' Apply the settings to the message.
With iMsg
    Set .Configuration = iConf
    .To = " somebodysemail@a... "
    .From = " myemailaddress@s... "
    .Subject = "This is a test CDOSYS message (Sent via Port 25)"
    .HTMLBody = strHTML
    .Send
End With

' Clean up variables.
Set iMsg = Nothing
Set iConf = Nothing
Set Flds = Nothing
%>

> -----Original Message-----
> From: Carl E. Olsen [mailto:carl-olsen@m...]
> Sent: Saturday, August 31, 2002 5:00 PM
> To: ASP+
> Subject: [aspx] RE: ASP and sending email through SMTP MDaemon Mail
Server
> 
> Here's the code for ASP.
> 
> <%
> Dim MyMail, MyBody
> MyBody = "This is my message"
> Set MyMail = Server.CreateObject("CDONTS.NewMail")
> MyMail.From = "myemailaddress@s..."
> MyMail.To = "somebodysemail@a..."
> MyMail.Subject = "Here's a message"
> MyMail.Body = Body
> MyMail.Send
> Set MyMail = nothing
> %>
> 
> > -----Original Message-----
> > From: Kevin Smith [mailto:kevin@n...]
> > Sent: Saturday, August 31, 2002 9:43 PM
> > To: ASP+
> > Subject: [aspx] ASP and sending email through SMTP MDaemon Mail
Server
> >
> > Hi All,
> >
> > From what I have read, you cannot code an ASP page (not .NET) to
send
> > email through an SMTP mailserver, is this correct?
> >
> > However, if it is possible, does anyone have any code I can use to
> send
> > SMTP mail.  I have MDaemon 6.0.5 running on my Windows 2000 server,
> which
> > also runs the IIS/ASP webserver.  Is there any generic code to send
> email
> > via any SMTP server?
> >
> > I use PHP and Perl heavily and this is the easiest thing to do, can
> ASP
> > not do this?
> >
> > Many thanks,
> >
> > Kevin Smith
> > ---
> >
> > ASP.NET 1.0 Namespace Reference with C#
> > http://www.wrox.com/acon11.asp?ISBN=1861007442
> >
> > ASP.NET 1.0 Namespace Reference with VB.NET
> > http://www.wrox.com/acon11.asp?ISBN=1861007450
> >
> > These books are a complete reference to the ASP.NET namespaces
> > for developers who are already familiar with using ASP.NET.
> > There is no trivial introductory material or useless .NET
> > hype and the presentation of the namespaces, in an easy-to use
> > alphabetical order ensures a user-friendly reference format.
> > We provide in-depth coverage of all the major ASP.NET classes,
> > giving you those real-world tips that the documentation doesn't
> > offer, and demonstrating complex techniques with simple
> > examples.
> >
> > ---
> 
> 
> 
> ---
> 
> ASP.NET 1.0 Namespace Reference with C#
> http://www.wrox.com/acon11.asp?ISBN=1861007442
> 
> ASP.NET 1.0 Namespace Reference with VB.NET
> http://www.wrox.com/acon11.asp?ISBN=1861007450
> 
> These books are a complete reference to the ASP.NET namespaces
> for developers who are already familiar with using ASP.NET.
> There is no trivial introductory material or useless .NET
> hype and the presentation of the namespaces, in an easy-to use
> alphabetical order ensures a user-friendly reference format.
> We provide in-depth coverage of all the major ASP.NET classes,
> giving you those real-world tips that the documentation doesn't
> offer, and demonstrating complex techniques with simple
> examples.
> 
> ---



  Return to Index