Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I check the value of the mail server outside of Admin?

Status
Not open for further replies.

TheDrider

Programmer
Jun 27, 2001
110
US
We use our application at several different locations on multiple servers. (Military stand-alone instances.) I would like to set up my email code to run regardless of whether or not a particular instance has a valid smtp server defined.

Currently the cfmail fails if the admin's SMTP server field is blank, so we have to set up a dummy server as in "no.email.server". Can I check this SMTP field for a value before calling cfmail?

Thanks much.
 
Well, it doesn't appear to be stored in the registry. There does seem to be a config file cfusionmx\lib\neo-mail.xml that contains the name of the mail server, but in a military installation, you might not be able to read it directly.. that'd be kind of iffy anyway. I'd just wrap it in a cftry and then put another version with the fake mail server in the cfcatch:

Code:
<cftry>
<cfmail etc..>
text
</cfmail>
<cfcatch type="any">
<cfmail server="alternate">
text
</cfmail>
</cfcatch>
</cftry>

You could even be slick and do something like this inside the cfcatch:

Code:
<cfset mailserverfile=getdirectoryfrompath(getcurrenttemplatepath())&"mailserver.txt">
<cfif fileexists(mailserverfile)>
<cffile action="read" file="#mailserverfile#" variable="mailserver">
<cfmail server="#mailserver#">
etc...
</cfif>

A lot of this will depend on what resources you have from the server of course
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top