|
-
Dec 7th, 2006, 11:11 AM
#1
Thread Starter
Fanatic Member
[RESOLVED] [2005] Email in 2005 from 2003
Hello,
I have an interesting problem:
We've built special software that processes our Sales Orders and emails, faxes, or EDI's them at various points throughout the day. This data is collected, then e-mailed out to the appropriate people.
This was built in .NET 2003, and uses the System.Web.MailMessage namespace/interface.
In 2005, that isn't really supported - it's done through the System.Net.Mail namespace instead. The problem is this:
In 2003, you can authenticate on the message itself, your password/username for your account. Without that, you won't send the message. This is how you do it:
VB Code:
oMsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1") 'basic authentication
oMsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "username/domain") 'set your username here
oMsg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "thepassword") 'set your password here
What I can't seem to do, is get that to work in 2005. Those fields don't exist, and I can't seem to find a way to authenticate myself to the SMTP server for Microsoft Exchange. Does anyone know?
Last edited by warrenayen; Dec 7th, 2006 at 11:12 AM.
Reason: removed sensitive password/domaininfo
Warren Ayen
Senior C# Developer
DLS Software Studios ( http://www.dlssoftwarestudios.com/)
I use Microsoft Visual Studio 2005, 2008, working with Visual Basic and Visual C#
Hey! If you like my post, or I solve your issue, please Rate Me!
-
Dec 7th, 2006, 01:24 PM
#2
Re: [2005] Email in 2005 from 2003
Try this
VB Code:
Dim oMsg As New System.Net.Mail.MailMessage
Dim mailClient As New System.Net.Mail.SmtpClient("smtp.sbcglobal.yahoo.com")
Dim basicAuthenticationInfo As New System.Net.NetworkCredential("username", "thepassword")
Try
mailClient.Credentials = basicAuthenticationInfo
mailClient.Send(oMsg)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
don't forget to set the oMsg object's properties!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|