copyco,
How does that saying go: use the right tool for the right job? :-|
Correct! System.Web.Mail does not handle SMTP authentication.
I would think that if you have a VBScript that does authenticated email,
than you can use the same code in VB.NET to also do authenticated
email. As
VB.NET handles COM (almost) as easy as VBScript handles COM.
I would think our time would be better served figuring out how to convert
your VBScript code to VB.NET and getting it to run, rather then how to
run
VBScript code from .NET...
For starters I would cut & paste the VBScript code into a new VB.NET
source
file that has Option Strict Off & Option Explicit Off (which is most
VBScript like).
Hope this helps
Jay
Jay B. Harlow [MVP - Outlook] wrote:
Actually, I'm using System.Web.Mail.MailMessage and
System.Web.Mail.SmtpMail.SmtpServer to send an e-mail message. The
problem is that I have .NET Framework v 1.0 which does not support SMTP
authentication. However, I'm able to write VBSript that does. I just
was wondering how I could execute the script from the executable itself
instead of run it externally. It just seems to be a clumsy way of doing
it.
I tried your suggestion but it isn't working. It gives me the error
'The "SendUsing" configuration value is invalid.' However this code
works fine as a VBScript. I'm just about ready to throw up my hands and
just call the script from my executable. Here's the code below. Perhaps
someone can point out the error.
\\\
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim objEmail = CreateObject("CDO.Message")
'Dim objEmail As New CDO.Message()
objEmail.From = "my_email@my_isp.net"
objEmail.To = "(e-mail address removed)"
objEmail.Subject = "test message"
objEmail.TextBody = "This is a test."
objEmail.Sender = "my_email@my_isp.net"
With objEmail.Fields
.Item("
http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Item("
http://schemas.microsoft.com/cdo/configuration/smtpserver") =
"smtp.swbell.yahoo.com"
.Item("
http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
.Item("
http://schemas.microsoft.com/cdo/configuration/sendusername") =
"my_email@my_isp.net"
.Item("
http://schemas.microsoft.com/cdo/configuration/sendpassword") =
"my_password"
.Item("
http://schemas.microsoft.com/cdo/configuration/smtpauthenticate")
= 1
End With
objEmail.Configuration.Fields.Update()
objEmail.Send()
End Sub
///