I really, really need smtp help

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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 = "(e-mail address removed)"
objMail.From = "(e-mail address removed)"
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.
 
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
(e-mail address removed)
(please, replace dots with appropriate letters)
 
Back
Top