Home > Domino Tips > Administrator > SMTP > Automatically Update Valid Internet Addresses Field in Server Config Doc
Domino Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

SMTP

Automatically Update Valid Internet Addresses Field in Server Config Doc


Patty Halsey
01.29.2001
Rating: -3.60- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


In order to force incoming smtp mail to only accept mail based on the standard, the "Allow messages intended only for the following internet addresses:" needs to be populated with all addresses a company wants to use. However updating this manually is not an acceptable way to insure it's validity 100% of the time. This agent goes through all person documents, mail-in database documents, and group documents and extracts all internet addresses and then writes them to the field in the server configuration document. We had to add an InternetAddress field to the group document and if a person needs to receive e-mail by more than one address, we also check the FullName field for this. Run this agent scheduled as often as desired to keep the config doc up to date.

Code

Sub Initialize
	Dim session As New NotesSession
	Dim db As NotesDatabase
	Dim pview As NotesView          'people
	Dim gview As NotesView		' groups
	Dim mdbview As NotesView	' mail-in dbs
	Dim cview As NotesView		' config docs
	Dim pdoc As NotesDocument
	Dim gdoc As NotesDocument
	Dim mdbdoc As NotesDocument
	Dim cdoc As NotesDocument
	Dim addrarray() As String
	Dim i As Integer
	
	Set db = session.CurrentDatabase
	i = 0																			' start array counter
	
' Process the person documents	
	Set pview = db.GetView("People")
	Set pdoc = pview.GetFirstDocument
	While Not(pdoc Is Nothing)
		If pdoc.HasItem("InternetAddress") Then						' check existance of internet address field
			Redim Preserve addrarray(i)
			addrarray(i) = pdoc.GetItemValue("InternetAddress")(0)	' write to array
			i = i + 1																' increment array counter
		End If
		Forall x In pdoc.GetItemValue("FullName")						' loop through all entries in full name field
			If Instr(1, x, "@") > 0 Then										' check for an internet address
				Redim Preserve addrarray(i)	
				addrarray(i) = x									'write to array
				i = i + 1															' increment array counter
			End If
		End Forall
		Set pdoc = pview.GetNextDocument(pdoc)
	Wend
	
' Process the group documents
	Set gview = db.GetView("Groups")
	Set gdoc = gview.GetFirstDocument
	While Not(gdoc Is Nothing)
		If gdoc.HasItem("InternetAddress") Then						' check existance of internet address field
			Redim Preserve addrarray(i)
			addrarray(i) = gdoc.GetItemValue("InternetAddress")(0)	' write to array
			i = i + 1																' increment array counter
		End If
		Set gdoc = gview.GetNextDocument(gdoc)
	Wend
	
' Process the mail-in db documents
	Set mdbview = db.GetView("Mail-In Databases")
	Set mdbdoc = mdbview.GetFirstDocument
	While Not(mdbdoc Is Nothing)
		If mdbdoc.HasItem("InternetAddress") Then						' check existance of internet address field
			Redim Preserve addrarray(i)
			addrarray(i) = mdbdoc.GetItemValue("InternetAddress")(0)	' write to array
			i = i + 1																	' increment array counter
		End If
		Set mdbdoc = mdbview.GetNextDocument(mdbdoc)
	Wend	
	
' Get and update config document
	Set cview = db.GetView("Configurations")
	Set cdoc = cview.GetFirstDocument
		' If address book has more than one config doc, or more than one server receiving smtp mail, 
		' this has to be changed to find the one(s) needing updating. 
	Set cdoc.AllowMailForInternetAddresses = cdoc.ReplaceItemValue("AllowMailForInternetAddresses", Fulltrim(addrarray))
		 ' and remove empty items in array
	Call cdoc.Save( True, True )
End Sub

Rate this Tip
To rate tips, you must be a member of SearchDomino.com.
Register now to start rating these tips. Log in if you are already a member.


Submit a Tip




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


RELATED CONTENT
SMTP
Use SMTP outbound authentication to relay hosts in Lotus Notes Domino 8
How to send a form to a non-Lotus Notes email client
Seven tips to strengthen your Domino e-mail security
Enhance spam prevention with Domino's blacklist scanning exceptions
ND6 spam protection for R5
Another way of setting your DNS server
Disallow setting your own email address
Prevent Spam/Relayed Mail (Mixed Grill)
Load balancing relay hosts
Connection error from host IP_address

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



Domino & Lotus Notes Security Solutions: Authentication, Antispam, Encryption and Antivirus
HomeTopicsITKnowledge ExchangeTipsAsk the ExpertsMultimediaWhite PapersDomino IT Downloads
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides enterprise IT professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective IT purchase decisions and managing their organizations' IT projects - with its network of technology-specific Web sites, events and magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Reprints  |  Site Map




All Rights Reserved, Copyright 1999 - 2008, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts