473,692 Members | 2,049 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Sending Emails

Hi all
I use:
Dim message As New MailMessage(txt To.Text, txtFrom.Text, txtSubject.Text ,
txtBody.Text)
Dim emailClient As New SmtpClient(txtS MTPServer.Text)
emailClient.Sen d(message)

And its working fine.
However I was wondering if there is a way to confirm that the email was sent.
The send method does not return anything....

Please advise

TIA
Guy Cohen
Jan 6 '08 #1
4 2396
On Jan 6, 5:40 pm, Guy Cohen <GuyCo...@discu ssions.microsof t.com>
wrote:
Hi all
I use:
Dim message As New MailMessage(txt To.Text, txtFrom.Text, txtSubject.Text ,
txtBody.Text)
Dim emailClient As New SmtpClient(txtS MTPServer.Text)
emailClient.Sen d(message)

And its working fine.
However I was wondering if there is a way to confirm that the email was sent.
The send method does not return anything....

Please advise

TIA
Guy Cohen
After "emailclient.se nd" you add a messagebox which confirms success,
that's all. I've done like that and works.

Like:
Try
Dim message As New MailMessage(txt To.Text, txtFrom.Text,
txtSubject.Text ,
txtBody.Text)
Dim emailClient As New SmtpClient(txtS MTPServer.Text)
emailClient.Sen d(message)
msgbox("success fully sent")

Catch ex as exception
Msgbox(ex.messa ge)

end try

You can test, enter some invalid SMTP server address then you will get
a error in msgbox(ex.messa ge) which is defined inside catch method
saying with "failure sending mail"

Hope this helps.

Let us know

Regards.
Jan 6 '08 #2
In other words - you say if "on error" or "try/catch" did not trap any error
it means - it is ok?
....Can someone approve that ?

"kimiraikko nen" wrote:
On Jan 6, 5:40 pm, Guy Cohen <GuyCo...@discu ssions.microsof t.com>
wrote:
Hi all
I use:
Dim message As New MailMessage(txt To.Text, txtFrom.Text, txtSubject.Text ,
txtBody.Text)
Dim emailClient As New SmtpClient(txtS MTPServer.Text)
emailClient.Sen d(message)

And its working fine.
However I was wondering if there is a way to confirm that the email was sent.
The send method does not return anything....

Please advise

TIA
Guy Cohen

After "emailclient.se nd" you add a messagebox which confirms success,
that's all. I've done like that and works.

Like:
Try
Dim message As New MailMessage(txt To.Text, txtFrom.Text,
txtSubject.Text ,
txtBody.Text)
Dim emailClient As New SmtpClient(txtS MTPServer.Text)
emailClient.Sen d(message)
msgbox("success fully sent")

Catch ex as exception
Msgbox(ex.messa ge)

end try

You can test, enter some invalid SMTP server address then you will get
a error in msgbox(ex.messa ge) which is defined inside catch method
saying with "failure sending mail"

Hope this helps.

Let us know

Regards.
Jan 6 '08 #3
On Jan 6, 6:35 pm, Guy Cohen <GuyCo...@discu ssions.microsof t.com>
wrote:
In other words - you say if "on error" or "try/catch" did not trap any error
it means - it is ok?
...Can someone approve that ?

"kimiraikko nen" wrote:
On Jan 6, 5:40 pm, Guy Cohen <GuyCo...@discu ssions.microsof t.com>
wrote:
Hi all
I use:
Dim message As New MailMessage(txt To.Text, txtFrom.Text, txtSubject.Text ,
txtBody.Text)
Dim emailClient As New SmtpClient(txtS MTPServer.Text)
emailClient.Sen d(message)
And its working fine.
However I was wondering if there is a way to confirm that the email was sent.
The send method does not return anything....
Please advise
TIA
Guy Cohen
After "emailclient.se nd" you add a messagebox which confirms success,
that's all. I've done like that and works.
Like:
Try
Dim message As New MailMessage(txt To.Text, txtFrom.Text,
txtSubject.Text ,
txtBody.Text)
Dim emailClient As New SmtpClient(txtS MTPServer.Text)
emailClient.Sen d(message)
msgbox("success fully sent")
Catch ex as exception
Msgbox(ex.messa ge)
end try
You can test, enter some invalid SMTP server address then you will get
a error in msgbox(ex.messa ge) which is defined inside catch method
saying with "failure sending mail"
Hope this helps.
Let us know
Regards.
Hi,
Have you tried the code?
I tried the code with entering an invalid SMTP code.

when it fails because of invalid smtp address you get "failure sending
mail" in a messagebox. Even there may be different reason of errors,
but i'm afraid .NET's mail send feature doesn't report the failure
reason. Just says "failure sending mail"
Catch ex as exception
Msgbox(ex.excep tion)

If there's no problem you get what you set as a success notification.
In this case you can use messagebox:

Try
Dim message As New MailMessage(txt To.Text, txtFrom.Text,
txtSubject.Text ,
txtBody.Text)
Dim emailClient As New SmtpClient(txtS MTPServer.Text)
emailClient.Sen d(message)
msgbox("success fully sent")

Catch ex as exception
Msgbox(ex.messa ge)

end try

Thanks.
Jan 6 '08 #4
On Jan 6, 6:44 pm, kimiraikkonen <kimiraikkone.. .@gmail.comwrot e:
On Jan 6, 6:35 pm, Guy Cohen <GuyCo...@discu ssions.microsof t.com>
wrote:
In other words - you say if "on error" or "try/catch" did not trap any error
it means - it is ok?
...Can someone approve that ?
"kimiraikko nen" wrote:
On Jan 6, 5:40 pm, Guy Cohen <GuyCo...@discu ssions.microsof t.com>
wrote:
Hi all
I use:
Dim message As New MailMessage(txt To.Text, txtFrom.Text, txtSubject.Text ,
txtBody.Text)
Dim emailClient As New SmtpClient(txtS MTPServer.Text)
emailClient.Sen d(message)
And its working fine.
However I was wondering if there is a way to confirm that the email was sent.
The send method does not return anything....
Please advise
TIA
Guy Cohen
After "emailclient.se nd" you add a messagebox which confirms success,
that's all. I've done like that and works.
Like:
Try
Dim message As New MailMessage(txt To.Text, txtFrom.Text,
txtSubject.Text ,
txtBody.Text)
Dim emailClient As New SmtpClient(txtS MTPServer.Text)
emailClient.Sen d(message)
msgbox("success fully sent")
Catch ex as exception
Msgbox(ex.messa ge)
end try
You can test, enter some invalid SMTP server address then you will get
a error in msgbox(ex.messa ge) which is defined inside catch method
saying with "failure sending mail"
Hope this helps.
Let us know
Regards.

Hi,
Have you tried the code?
I tried the code with entering an invalid SMTP code.

when it fails because of invalid smtp address you get "failure sending
mail" in a messagebox. Even there may be different reason of errors,
but i'm afraid .NET's mail send feature doesn't report the failure
reason. Just says "failure sending mail"
Catch ex as exception
Msgbox(ex.excep tion)

If there's no problem you get what you set as a success notification.
In this case you can use messagebox:

Try
Dim message As New MailMessage(txt To.Text, txtFrom.Text,
txtSubject.Text ,
txtBody.Text)
Dim emailClient As New SmtpClient(txtS MTPServer.Text)
emailClient.Sen d(message)
msgbox("success fully sent")

Catch ex as exception
Msgbox(ex.messa ge)

end try

Thanks.
Addition: Catch block also reports some other errors such as invalid
sender mail or destination mail like some strings but "before"
sending. As you know, after sending mail with correct standards(smtp
server name, correct form of mail address) there's no guarantee that
the destination address will be found on destination server, you may
get a returning failure mail from destination server if destination
mail address is unreachable due to any reason on server-side. It's
about regular mailing stragegy not about .NET's mail feature of
course.

Regards.
Jan 6 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2890
by: dan glenn | last post by:
I'm creating HTML emails from a PHP site and sending them out to an email list (just about 40 people so far are on this list). I've tested and confirmed that these emails work in yahoo.com's webmail. And I know they work on *my* Outlook Express. But I have one person (I know of) who gets the emails as plain text, so she sees the HTML code for the email instead of its proper representation. She has, like myself, OE6, and other html emails...
10
4972
by: Stuart Mueller | last post by:
I have an exchange server, that I sometimes use to perform mail shots to clients on our database, these can be upwards of 1000 at a time. As we don't want different clients to see who we are working with we put these mailshots in the bcc field of the mails. This can sometimes cause a problem as we are getting alot of mails bounced back. I would like to write a script to have these emails sent out individually using the to: field of the...
1
5145
by: Ian Taylor | last post by:
Hi all... Is it possible to send RTF-formatted emails using the .NET SmtpMail implementation? I can only find provision in the BodyFormat property of the message to send plain text or HTML emails. I also have a similar problem in sending HTML/RTF emails via MAPI and would appreciate any help anyone could give me in these areas.
3
2222
by: VB Programmer | last post by:
My company has it's own webserver, which is going to host our ASP.NET web application. We want the website to be able to send out emails. 1. What do I need on the server so that it has the abillity to send out emails? It is a Windows 2000 Professional SP3 server. 2. Any examples (code, etc...) on how to send out emails via an ASP.NET webform? Thanks!
2
9230
by: Mr. x | last post by:
Hello, I am sending emails with Hebrew contents. When receiving emails - I cannot see the Hebrew characters (it is not outlook express configuration, because when receiving emails from friends - I see hebrew, it is just sending by myself using *.aspx scripts). In web.config I have the following : <configuration> <system.web>
3
3611
by: Ant | last post by:
Hi, I'm using the MailMessage & smtpMail classes in System.Web.Mail to send mail, however it's not sending any emails. I'm using it on a Windows 2003 server. The simplest way to use this is smtpMail.Send("from@here.com", to@there.com, "Message subject", "Message Body") I'm sending it to my own email address on a different server using a dummy
5
23800
by: Kun | last post by:
i have the following code: ---------------------------------- import smtplib from email.MIMEText import MIMEText fp = open('confirmation.txt', 'rb') msg = MIMEText(fp.read()) From = 'xxxx@xxxx.xxxx.edu'
5
2438
by: Jai | last post by:
Hi, I am in a problem of sending mass emails(newsletter) to my website members. Actually my problem is this: I want to send newsletter to my website members. But I had given a facility for each member to choose different category of products or all products newsletter.
1
2942
by: robbiesmith79 | last post by:
Just so this is out there on the web, I battled the past 24 hours about this. Background info... I developed a ecommerce website in PHP 4 on a shared linux hosting plan from GoDaddy and had the html formatted emails sending as text/html and were going fine with limited header information. Then we moved the site over to a Dedicated Linux hosting plan. This time, it's PHP 5. Things are bound to not work as expected moving to a new...
2
3755
by: lstanikmas | last post by:
Hi, I'm validating a form with this ASP but receiving some blank email responses; does anyone see anything wrong with it?: function isFormVarExcluded(thisForm, strToCheck) { var strExcludeVars = thisForm.elements.value; var arrExcludeVars = strExcludeVars.split(","); for (var j=0; j<arrExcludeVars.length; j++) { if (arrExcludeVars == strToCheck) return true;
0
8538
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9083
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8961
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6459
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5819
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4324
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4557
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2974
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2238
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.