Properly Handling Exception Handling


Author
Message
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.3K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Oh, how did you send the email? I've been thinking about doing this also, and am investigating ways of doing it.
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
.NET actually has some good SMTP classes for sending emails.  Here is a simple example (I went ahead and showed how to authenticate as this is generally the next question.  If you are mailing from an internal server that will relay your message you might not need this, but I thought it would help.  Also, you can format the mail message to support HTML, etc.  I just showed you the basics.

Dim smtp As New System.Net.Mail.SmtpClient("mymail.server.com")
Dim mailItem As New System.Net.Mail.MailMessage("myEmail@somewhere.com", _
                                                "someone@there.com", _
                                                "Howdy", _
                                                "Here is the body")

smtp.Credentials = New System.Net.NetworkCredential("MyUserName", "MyPassword")
smtp.Send(mailItem)

Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.3K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Thanks Trent. I've heard that this can fail because ISPs block mail sent to servers outside of their domain. Is this something you've heard of? I.e. I'm accessing the internet via a wireless connection at a hotel or using the network connection at a client site, attempt to send an email via the SMTP server at my company and the hosting network blocks the email.
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Is this something you've heard of?

Thus the credentials.  If you supply a mail server, port, and credentials...that's email...period Smile  We use this everywhere.  The only thing that you cannot do is pull mail down from a POP3 server...but sending...no problem Smile

Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.3K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Very cool! Thanks!
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search