Wrox Programmer Forums
|
ASP.NET 1.1 As of 10/6/2005, this forum is locked as part of the reorganization described here: http://p2p.wrox.com/topic.asp?TOPIC_ID=35394. No posts have been deleted. Open ongoing discussions from the last week have been moved to either ASP.NET 1.0 and 1.1 Beginners http://p2p.wrox.com/asp-net-1-0-1-1-basics-60/ or ASP.NET 1.0 and 1.1 Professional. http://p2p.wrox.com/forum.asp?FORUM_ID=50. See my sticky post inside for more.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.1 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 January 18th, 2005, 07:31 PM
Friend of Wrox
 
Join Date: Apr 2004
Posts: 204
Thanks: 0
Thanked 0 Times in 0 Posts
Default SMTPMail or CDOSYS

Is SMTPMail the only way to go in ASP.Net or can one still use the CDOSYS object. Is there any reason to use one over the other?

Thanks.

Aaron

 
Old January 19th, 2005, 09:21 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
Default

With ASP.NET you should use SMTPMail.

 
Old January 19th, 2005, 09:26 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Here is a guide:
http://www.sitepoint.com/article/sen...-email-asp-net


 
Old January 19th, 2005, 02:37 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

System.Web.Mail is just a wrapper around CDOSYS. So, under the hood you're still using CDOSYS anyway.

However, although you're not using entirely managed code, I suggested you stick to the System.Web.Mail stuff, as it provides a cleaner, and more consistent API.

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old January 21st, 2005, 01:56 PM
Friend of Wrox
 
Join Date: Apr 2004
Posts: 204
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks once again Imar. Are there properties of this class which duplicate the .fields collection of the CDOSYS class? Specifically I need to be able to log into a remote SMTP server using a login and password. Thanks.

Aaron

 
Old January 21st, 2005, 04:13 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Aaron,

Take a look here, and follow the links: http://blogs.msdn.com/darrenj/archiv.../22/51984.aspx

The trick is to use the undocumented Fields collection, not documented here: http://msdn.microsoft.com/library/de...ieldstopic.asp

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old January 21st, 2005, 10:34 PM
Friend of Wrox
 
Join Date: Apr 2004
Posts: 204
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Well, I'm almost there. Here's what I have so far...

Imports System.Web.Mail
Public Class Confirmation
Inherits System.Web.UI.Page

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

'Generate a confirmation email and send it
Dim Message As New MailMessage
Message.To = "SomeEmail"
Message.Cc = "SomeCc"
Message.From = "[email protected]" 'This is a registered user on the server
Message.Subject = "Some Subject"
Message.Body = "Body in HTML format"
Message.BodyFormat = Web.Mail.MailFormat.Html
SmtpMail.SmtpServer = "Mail server address"

'This is what I tried based on the links that Imar suggested
Message.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", 1)
Message.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "JobApp")
Message.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "pwd")
SmtpMail.Send(Message)

The Error Message I keep getting is "The transport failed to connect to the server."

If I don't use the smtp authentication fields then it works fine, but it will only send to addresses within my domain (some kind of relaying thing I think).

Thanks!

Aaron

 
Old January 22nd, 2005, 06:17 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Did this ever work with CDOSYS?

Maybe it's a configuration error, where the JobApp account is not allowed to relay message outside your network?

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old January 25th, 2005, 05:50 PM
Authorized User
 
Join Date: Jan 2005
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

What is the name of the SMTPServer you used ? If you know the IP Address of the Server then put that in place of "Mail server address".



Hope It Helps !!
Bhaskar Ghosh
 
Old January 26th, 2005, 03:39 AM
Friend of Wrox
 
Join Date: Apr 2004
Posts: 204
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi guys,

Okay I figured it out. Imar's questionmade me think to try it exactly like I used to do it with CDOSYS.

BAsically, I never had to authenticate with this particular webhost. Weird I know, but that's how they operate. I changed the configuration to:

SmtpMail.SmtpServer = "localhost"
Message.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusing", 1)
Message.BodyFormat = Web.Mail.MailFormat.Html
SmtpMail.Send(Message)

What had me stuck for a little bit was that the email I was using to test the thing happenned to be a domain within the same network as my web server, and CDOSYS doesn't deliver within a network, but only to addresses outside the network. When I tried a different email it worked just fine.

Thanks for your help!

Aaron






Similar Threads
Thread Thread Starter Forum Replies Last Post
About SmtpMail.Send() Method hhkris4u ASP.NET 1.0 and 1.1 Professional 3 February 6th, 2007 04:24 AM
SMTPMail in a Service mglass VB How-To 0 August 6th, 2003 05:02 AM





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