Hope you can get thru my VB.NET code -- this is implemented from one of my
web applications.
Imports System.Net.Mail
' Customer and Site are my classes
' MyCompany -- well that is obvious ;)
' Validate Customer EMail address, Site EMail Server, Site EMail
Confirmation address have been provided
If Not String.IsNullOrEmpty(Customer.EMail) And _
Not String.IsNullOrEmpty(Site.EMailServer) And _
Not String.IsNullOrEmpty(Site.EMailServerConfirmationA ddy) Then
Dim Phone As New MyCompany.Utilities.Conversion
Dim OS As New MyCompany.Utilities.OperatingSystem
Dim smtpMailClient As New System.Net.Mail.SmtpClient
Dim SiteConfirmEMail = New
System.Net.Mail.MailAddress(Site.EMailServerConfir mationAddy, Site.SiteName)
Dim CustomerEMail = New
System.Net.Mail.MailAddress(Customer.EMail, Customer.FirstName & " " &
Customer.LastName)
Dim SiteEMail = New
System.Net.Mail.MailAddress(Site.FacilityEMail, Site.SiteName)
Dim BccEMail = New System.Net.Mail.MailAddress(OS.Get_EMailBcc,
"")
Dim ConfirmationMessage As New System.Net.Mail.MailMessage
With ConfirmationMessage
.From = SiteConfirmEMail
.To.Add(CustomerEMail)
.Bcc.Add(BccEMail)
.CC.Add(SiteEMail)
.Subject = Site.SiteName & " Confirmation"
.IsBodyHtml = True
.Priority = System.Net.Mail.MailPriority.Normal
.Body = Build_Letter_HTML(Customer, Site)
End With
Try
With smtpMailClient
.Host = Site.EMailServer
.DeliveryMethod = SmtpDeliveryMethod.Network
If Site.EMailServerAuthentication Then
.Credentials = New
System.Net.NetworkCredential(Site.EMailServerAuthU serID,
Site.EMailServerAuthPassword)
End If
.Send(ConfirmationMessage)
End With
Catch exSMTP As SmtpException
lb_WelcomeCustomer.Text =
Build_MailServerDown_HTML(Customer, Site)
Catch ex As Exception
lb_WelcomeCustomer.Text =
Build_ConfirmationDown_HTML(Customer, Site)
End Try
Else
lb_WelcomeCustomer.Text = "Invalid E-mail account or E-Mail
server not configured correctly."
End If
"herbert" <he*****@discussions.microsoft.com> wrote in message
news:22**********************************@microsof t.com...
Rob,
Can you make any of the samples (from VS online help, MSDN or related web
sites) work without deep knowledge of the computer your code executes???
In other words: mabye the smtpclient class in .NET 2.0 is better
structured,
however its description is useless for novice to medium programmers (ie
those
without sysadmin experience and access rights).
And even if you succeed, there is still no way to create a setup project
with reasonable effort that can do what you do.
Let's ask Microsoft to prove it: please give us a complete VS.2005 project
to download that sends eMail and includes an installer project.
herbert