Hi all, I am writing a agent which is running in web.
In the agent I want to check the valid mail id.
How I will check in Lotus Script.
I am writing
============================
Dim s As New notessession
Dim db As NotesDatabase
Dim udoc As NotesDocument
Set db=s.CurrentDatabase
Set udoc=s.DocumentContext
mail=udoc.email(0)
If Trim(mail) Like “@.com” Or mail Like “@.org” Then
???
==============================
After this what I will write for checking the valid mail address.
Please guide me.
Subject: How To Check the email validation in Lotus Script
- How about writing it more like:
If NOT Trim(mail) Like “@.com” Or mail Like “@.org” Then call mailERROR
(and write an ERROR script)
(then write the rest of what you want the script to do).
Keep in mind that there are a lot of valid TLDs besides .com and .org (like .net, .co.uk, etc. etc.)
Subject: RE: How To Check the email validation in Lotus Script
//E-MAIL VALIDATION IS BELOWfunction echeck(str) {
var at="@"
var dot="."
var lat=str.indexOf(at)
var lstr=str.length
var ldot=str.indexOf(dot)
if (str.indexOf(at)==-1){
alert("Invalid E-mail ID")
return false
}
if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
alert("Invalid E-mail ID")
return false
}
if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
alert("Invalid E-mail ID")
return false
}
if (str.indexOf(at,(lat+1))!=-1){
alert("Invalid E-mail ID")
return false
}
if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
alert("Invalid E-mail ID")
return false
}
if (str.indexOf(dot,(lat+2))==-1){
alert("Invalid E-mail ID")
return false
}
if (str.indexOf(" ")!=-1){
alert("Invalid E-mail ID")
return false
}
return true
}
function ValidateEmail(){
var emailID=document._orderform.EmailAddress
if ((emailID.value==null)||(emailID.value=="")){
alert("Please Enter your Email ID")
emailID.focus()
return false
}
if (echeck(emailID.value)==false){
emailID.value=""
emailID.focus()
return false
}
return true
}
*/