469,616 Members | 1,599 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,616 developers. It's quick & easy.

send mail in .NET 2.0

sendmail in .NET 2.0 is as useless as it was in .NET 1.x
I can't find out how to make it work. Not to mention how to write a setup
project that tests/installs its requirements correctly.

the difference to previous version is that .NET 1.x gave no error message at
all and .NET 2.0 gives useless error message when sendmail fails.

why is Microsoft not able to ship a sendmail class that works out of the box
at least with their own hotmail.com infrastructure?
and which does not need access to windows services configuration which
students don't have?

Or buy one of the companies that offer send mail + receive mail and ship
this as part of .Net 2.0 bugfix release.

over and out. herbert
Feb 14 '06 #1
4 1432
..NET 2.0 mail is much better than .NET 1.1 -- it is structured differently
so if you port to 2.0 you'll need to change a few things, but it works well
with secure severs now at least, don't know if it still has the >1024
character problem (aka you need to insert crlf in body text to prevent the
bizarre symbols that may appear).

I believe you have to go a couple of levels deep to get the exact error, but
the error is there. Keep in mind it can only return what the EMail server
reports to it.
"herbert" <he*****@discussions.microsoft.com> wrote in message
news:BE**********************************@microsof t.com...
sendmail in .NET 2.0 is as useless as it was in .NET 1.x
I can't find out how to make it work. Not to mention how to write a setup
project that tests/installs its requirements correctly.

the difference to previous version is that .NET 1.x gave no error message
at
all and .NET 2.0 gives useless error message when sendmail fails.

why is Microsoft not able to ship a sendmail class that works out of the
box
at least with their own hotmail.com infrastructure?
and which does not need access to windows services configuration which
students don't have?

Or buy one of the companies that offer send mail + receive mail and ship
this as part of .Net 2.0 bugfix release.

over and out. herbert

Feb 14 '06 #2
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
Feb 14 '06 #3
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

Feb 15 '06 #4
Unless you have configured IIS to use SMTP properly, nothing will make the
System.Net.Mail stuff work properly.
--
Christopher A. Reed
"The oxen are slow, but the earth is patient."

"herbert" <he*****@discussions.microsoft.com> wrote in message
news:BE**********************************@microsof t.com...
sendmail in .NET 2.0 is as useless as it was in .NET 1.x
I can't find out how to make it work. Not to mention how to write a setup
project that tests/installs its requirements correctly.

the difference to previous version is that .NET 1.x gave no error message
at
all and .NET 2.0 gives useless error message when sendmail fails.

why is Microsoft not able to ship a sendmail class that works out of the
box
at least with their own hotmail.com infrastructure?
and which does not need access to windows services configuration which
students don't have?

Or buy one of the companies that offer send mail + receive mail and ship
this as part of .Net 2.0 bugfix release.

over and out. herbert

Feb 17 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

15 posts views Thread by Steve Horrillo | last post: by
6 posts views Thread by John J. Hughes II | last post: by
15 posts views Thread by cj | last post: by
4 posts views Thread by =?Utf-8?B?dHBhcmtzNjk=?= | last post: by
reply views Thread by devrayhaan | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.