473,386 Members | 1,924 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Is there a way to verify that an email was sent?

Seth Schrock
2,965 Expert 2GB
I'm using the following code to send emails from my database:
Expand|Select|Wrap|Line Numbers
  1. Public Sub SendEmail(strSubject As String, strText As String, _
  2.                 strTo As String, Optional strFrom As String)
  3.  
  4. Dim cdoConfig As Object
  5. Dim msgOne As Object
  6.  
  7. Set cdoConfig = CreateObject("CDO.Configuration")
  8. With cdoConfig.Fields
  9.     .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
  10.     .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = 25
  11.     .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "Exchange.ftc.com"
  12.     .Update
  13. End With
  14.  
  15. If strFrom & "" = "" Then strFrom = "Database_Notification@fountaintrust.com"
  16.  
  17. Set msgOne = CreateObject("CDO.Message")
  18. Set msgOne.Configuration = cdoConfig
  19.  
  20. With msgOne
  21.     .To = strTo
  22.     .From = strFrom
  23.     .Subject = strSubject
  24.     .TextBody = strText
  25.     .Send
  26. End With
  27.  
  28. Set cdoConfig = Nothing
  29. Set msgOne = Nothing
  30.  
  31. End Sub
I would like to be able to verify that the email was sent. I know that delivery confirmation requests can be used, but that is dependent on the receiver allowing it to be sent so it isn't totally dependable.

The other idea that I had was change it from a sub to a function and use it as a flag of some sort. I would just have to trust that since the email addresses are saved in the database that they are accurate. If there was an error going through the code, then the error handler would set the function to 1. If the function didn't have an error, then the function would return a 0. Is this a valid idea or does it make me worthy of brain surgery to fix the cobwebs in my brain?
Feb 26 '13 #1
3 6601
Rabbit
12,516 Expert Mod 8TB
If the code runs without error then the e-mail was probably sent.

Whether or not it arrived at it's destination is another question. If you don't get an e-mail saying that the mail server was not found, then it probably arrived at it's destination.

And whether or not the target opened it is yet another question. You could use read confirmations, but that's not accurate. Some people use a 1x1 image that is linked to the server by an ID to find out if an e-mail was opened. But some e-mail applications block images from loading for that very purpose. So that's not completely reliable either but is more so than the other option.
Feb 26 '13 #2
zmbd
5,501 Expert Mod 4TB
ahh... think I just found my reference link:
Sending mail from Excel with CDO
I know... it says Excel; however, it covers the CDO method.

In an excel add-in that I have, I use this method to send error messages to me. We used to use "Groupwise" as our email... here I was looking thru my Access references and it was from my old Excel97 work.
Feb 26 '13 #3
Seth Schrock
2,965 Expert 2GB
So basically, I can use my function idea to make sure that the code ran without an error. This would mean that the email was sent. I guess I can play with delivery notifications and see what that tells me.

Is there a way to trap for an error of a bad email address? Maybe I just need to add a reply to address so that delivery errors get sent to me by coding my email address into the reply to address.
Feb 27 '13 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: vishal | last post by:
how can i verify the email address entered by client??? is there any readily available function for that in php or mysql????? else suggest me some links for verifying email address enetered...
5
by: Dan Williams | last post by:
Apologies for the cross-post but i thought i'd aim for the largest audience possible. I have a web site that users have to register to with their email address. The site then emails the user...
2
by: Cherry | last post by:
Hi, I have an intranet application that should validate the Email Address from the local SMTP Server. I have tried using CDO.Message but that does not seem to have functionality to verify the...
0
by: Imran Aziz | last post by:
Hello All, I am using System.Net.Mail (.net 2) class to send out emails. What I want to do is set the property in the email sent to expire after 24 hours. This can be done in Outlook by using the...
2
by: Wayne Wengert | last post by:
I want to write a Windows application to go through all the email addresses in an SQL Server table and to report which ones are invalid. From Googling and perusing NGs it is my understanding that...
1
by: sa | last post by:
Hi, Is there a way to get email sent or not with C#. I can understand if I get error message in my yahoo account. But is there a way to get this after SMTPClient.Send method? Regards, Salim
1
by: summer | last post by:
Hello, I'm not receiving my email, I believe I'm almost there, but can't figure out what I'm missing. Any Clue would be appreciated. Here's my html and asp code. I've included the cdovbs.inc...
1
by: Grey | last post by:
I have to write a program to verify email address availability. i have to verify thousand of email address. is there any way to verify the email in ..net instead. the requirement is to verify which...
3
by: Grey | last post by:
I have to write a program to verify email address availability. i have to verify thousand of email address. is there any way to verify the email in ..net instead. the requirement is to verify which...
0
by: TimeTT | last post by:
I have a problem with an add-in I support when "Send immediately when connected" is unchecked. The add-in is causing the first email sent to sit permanently in the Outbox. This email has Date as None...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

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.