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.IsNullOr Empty(Customer. EMail) And _
Not String.IsNullOr Empty(Site.EMai lServer) And _
Not String.IsNullOr Empty(Site.EMai lServerConfirma tionAddy) Then
Dim Phone As New MyCompany.Utili ties.Conversion
Dim OS As New MyCompany.Utili ties.OperatingS ystem
Dim smtpMailClient As New System.Net.Mail .SmtpClient
Dim SiteConfirmEMai l = New
System.Net.Mail .MailAddress(Si te.EMailServerC onfirmationAddy , Site.SiteName)
Dim CustomerEMail = New
System.Net.Mail .MailAddress(Cu stomer.EMail, Customer.FirstN ame & " " &
Customer.LastNa me)
Dim SiteEMail = New
System.Net.Mail .MailAddress(Si te.FacilityEMai l, Site.SiteName)
Dim BccEMail = New System.Net.Mail .MailAddress(OS .Get_EMailBcc,
"")
Dim ConfirmationMes sage As New System.Net.Mail .MailMessage
With ConfirmationMes sage
.From = SiteConfirmEMai l
.To.Add(Custome rEMail)
.Bcc.Add(BccEMa il)
.CC.Add(SiteEMa il)
.Subject = Site.SiteName & " Confirmation"
.IsBodyHtml = True
.Priority = System.Net.Mail .MailPriority.N ormal
.Body = Build_Letter_HT ML(Customer, Site)
End With
Try
With smtpMailClient
.Host = Site.EMailServe r
.DeliveryMethod = SmtpDeliveryMet hod.Network
If Site.EMailServe rAuthentication Then
.Credentials = New
System.Net.Netw orkCredential(S ite.EMailServer AuthUserID,
Site.EMailServe rAuthPassword)
End If
.Send(Confirmat ionMessage)
End With
Catch exSMTP As SmtpException
lb_WelcomeCusto mer.Text =
Build_MailServe rDown_HTML(Cust omer, Site)
Catch ex As Exception
lb_WelcomeCusto mer.Text =
Build_Confirmat ionDown_HTML(Cu stomer, Site)
End Try
Else
lb_WelcomeCusto mer.Text = "Invalid E-mail account or E-Mail
server not configured correctly."
End If
"herbert" <he*****@discus sions.microsoft .com> wrote in message
news:22******** *************** ***********@mic rosoft.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