I am trying to get some help on how to send email via a remote smtp server. I
have posted here several times already. I need to be able to send email using
winforms, vb.net 2003 or 2005 through a remote smtp server. The server is
hosted by Web.com and I have talked to them but their support is NO HELP at
all.

I keep getting the error: Could not access 'CDO.Message' object

Here is the code that I am using:

Public Sub sendEmail(ByVal hostname As String)
Dim objMail As New MailMessage

Try
objMail.To = "address@to.com"
objMail.From = "address@from.com"
objMail.Subject = "Testing"
objMail.Body = "Body"


objMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserver", "smtp.registeredsite.com") 'basic authentication

objMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport", 25) 'basic authentication

objMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", 1) 'basic authentication

objMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusing", 2) 'basic authentication

objMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "myusername") 'set your username here

objMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "password") 'set your password here
SmtpMail.Send(objMail)

Catch ex As Exception
Throw ex
End Try

End Sub


I really need help on this so that I can finish this project.

--
Thanks,
enak

Re: I really, really need smtp help by Rasinec

Rasinec
Wed Sep 20 14:21:42 CDT 2006

Hello enak,

this is working for me:

System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage(From,
To, Subject, Body);
System.Net.Mail.SmtpClient mailClient = new
System.Net.Mail.SmtpClient(ConfigurationManager.AppSettings["smtp_server"]);
mailClient.Credentials = new System.Net.NetworkCredential(From,
ConfigurationManager.AppSettings["MailSettings"]);
mailClient.Send(message);

Code snippet is in C# (.NET Framework 2.0), but it is simple enough for you
to transform it to VB.NET


--

Regards,
Rasinec Ninoslav
www.ApplicationAspect.com
nras....@ApplicationAspect.com
(please, replace dots with appropriate letters)


"enak" <enak@discussions.microsoft.com> wrote in message
news:1FB1FDD6-DA15-4A74-8A4A-5FA710C6CCC5@microsoft.com...
>I am trying to get some help on how to send email via a remote smtp server.
>I
> have posted here several times already. I need to be able to send email
> using
> winforms, vb.net 2003 or 2005 through a remote smtp server. The server is
> hosted by Web.com and I have talked to them but their support is NO HELP
> at
> all.
>
> I keep getting the error: Could not access 'CDO.Message' object
>
> Here is the code that I am using:
>
> Public Sub sendEmail(ByVal hostname As String)
> Dim objMail As New MailMessage
>
> Try
> objMail.To = "address@to.com"
> objMail.From = "address@from.com"
> objMail.Subject = "Testing"
> objMail.Body = "Body"
>
>
> objMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserver",
> "smtp.registeredsite.com") 'basic authentication
>
> objMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport",
> 25) 'basic authentication
>
> objMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate",
> 1) 'basic authentication
>
> objMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusing",
> 2) 'basic authentication
>
> objMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername",
> "myusername") 'set your username here
>
> objMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword",
> "password") 'set your password here
> SmtpMail.Send(objMail)
>
> Catch ex As Exception
> Throw ex
> End Try
>
> End Sub
>
>
> I really need help on this so that I can finish this project.
>
> --
> Thanks,
> enak