Currently I have an email option that allows users to send out mass emails, they can select certain groups or send to the complete database that has an email address. The option uses MS Outlook, everything works great, but Outlook has a funny problem that if the email address isn't complete like missing the .com etc then Outlook will not send out anything and gives no message as to what email is wrong. I would like to put a check in this e-mail option that would check ahead of time and make sure the email is complete. I know this option should have been in the input screen where that information was entered but didn't know how and at the time didn't have this email option in the program.
Hopefully someone will have some code that will check for a complete e-mail address.
Thanks again for all your help
I dont know if there are any official "rules" for emails, but this is something I threw together for you: - Public Function fBoolValidEmail(strEmail As String) As Boolean
-
'Purpose: To make a few basic checks on email addresses to determine if they are valid
-
'Author: TheSmileyCoder
-
-
-
'Check that we received something
-
If strEmail & "" = "" Then
-
fBoolValidEmail = False
-
Exit Function
-
End If
-
-
'Checks that there is a @ in string
-
Dim intAT As Integer
-
intAT = InStr(1, strEmail, "@")
-
If Not intAT > 0 Then
-
fBoolValidEmail = False
-
Exit Function
-
End If
-
-
'Check that there is a . on the right hand side of the @
-
Dim intDOT As Integer
-
intDOT = InStr(intAT, strEmail, ".")
-
If Not intDOT > intAT Then
-
fBoolValidEmail = False
-
Exit Function
-
End If
-
-
'Check that the . part is either .com or .dk or .org
-
Dim strDomain As String
-
strDomain = LCase(Right(strEmail, Len(strEmail) - InStrRev(strEmail, ".")))
-
Select Case strDomain
-
Case "dk", "com", "org"
-
'Valid
-
fBoolValidEmail = True
-
Exit Function
-
Case Else
-
'POSSIBLY invalid
-
fBoolValidEmail = False
-
'If you want, you can comment out the following line
-
MsgBox "Unknown domain found:" & strDomain
-
Exit Function
-
-
End Select
-
End Function
I think that should atleast satisfy outlook. If you want to confirm the emails are valid, you can take a look at a something like this: Validating Emails 2 2297
I dont know if there are any official "rules" for emails, but this is something I threw together for you: - Public Function fBoolValidEmail(strEmail As String) As Boolean
-
'Purpose: To make a few basic checks on email addresses to determine if they are valid
-
'Author: TheSmileyCoder
-
-
-
'Check that we received something
-
If strEmail & "" = "" Then
-
fBoolValidEmail = False
-
Exit Function
-
End If
-
-
'Checks that there is a @ in string
-
Dim intAT As Integer
-
intAT = InStr(1, strEmail, "@")
-
If Not intAT > 0 Then
-
fBoolValidEmail = False
-
Exit Function
-
End If
-
-
'Check that there is a . on the right hand side of the @
-
Dim intDOT As Integer
-
intDOT = InStr(intAT, strEmail, ".")
-
If Not intDOT > intAT Then
-
fBoolValidEmail = False
-
Exit Function
-
End If
-
-
'Check that the . part is either .com or .dk or .org
-
Dim strDomain As String
-
strDomain = LCase(Right(strEmail, Len(strEmail) - InStrRev(strEmail, ".")))
-
Select Case strDomain
-
Case "dk", "com", "org"
-
'Valid
-
fBoolValidEmail = True
-
Exit Function
-
Case Else
-
'POSSIBLY invalid
-
fBoolValidEmail = False
-
'If you want, you can comment out the following line
-
MsgBox "Unknown domain found:" & strDomain
-
Exit Function
-
-
End Select
-
End Function
I think that should atleast satisfy outlook. If you want to confirm the emails are valid, you can take a look at a something like this: Validating Emails
That looks like it might do it. I'll give it a try in a little while and let you know how it works. Thanks for all your help.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: dixie |
last post by:
I have some code that adds new records into a table for each ID in a list
box when a button on a form is clicked. This works fine. My problem now is
that I wish to be able to edit all the records...
|
by: Sky |
last post by:
Hello:
Another question about trying to wring functionality from a DataGrid...
Have a DB table of "Contacts" -- 14 or more fields per record
Show in datagrid -- but only 5 columns (First,Last,...
|
by: Glenn M |
last post by:
I have a shared XML file on a server .
i also have one xslt file that performs a simple transform on in to
view the data.
now i want to have another page that lets users modify the shared xml...
|
by: Schultz |
last post by:
is there an easy to follow, source code in one document, article that
explains how to create an edit all DataGrid control?
and, I have a DataGrid setup where the client enters information for...
|
by: =?Utf-8?B?bWlrZWc=?= |
last post by:
Hi,
I am building a small Help Desk application for my company and need to be
able to edit "open" help desk issues. I use a simple datagrid to display
each issue (6 per page) , with an Edit...
|
by: ollielaroo |
last post by:
Hi guys,
Firstly I did do a search for this one first but I couldn't find anything related in this forum. I am using Dreamweaver MX and trying to build admin pages for an ASP site.
My problem is...
|
by: Anette |
last post by:
I found the FAQ:
I can't find any "edit" button by my post. The FAQ says "Your ability to edit your posts may also be time-limited, depending on how the administrator has set up the forum." I...
|
by: Ryan Liu |
last post by:
I have this problem: "cannot continue edit while debug in VS2005".
I see the same tread after I search this topic in google, but none solutions
works for me. So again, I ask here. Can someone...
|
by: rogerford |
last post by:
I have a grid which i bind with values from Database. I have events to edit and update the grid. I am not using SqlDatasource to connect to DB. Rather i am doing the updating of the grid...
|
by: chromis |
last post by:
Hi,
I'm having trouble fully implementing the edit section of a contact admin system, so far I have written the following:
- Bean (Contact.cfc)
- Data Access object (ContactDAO.cfc)
- Gateway...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
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,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
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...
|
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
|
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...
|
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...
| |