1

I've specified a Mail Server in my CFAdmin I want to get it in my code. Is it possible somehow?

Peter Boughton
  • 110,170
  • 32
  • 120
  • 176
Adil Malik
  • 6,279
  • 7
  • 48
  • 77

2 Answers2

4

I have to concede I've never had to specifically do what you need to do, but CF has an Admin API. Details are on the Administrator API page in the docs.

Relevant extract:

mail.cfc Manage ColdFusion mail settings.

I reckon that's what yer after.

Adam Cameron
  • 29,677
  • 4
  • 37
  • 78
  • 1
    Actually Peter raises a good point. We're both interpreting your question in a different way. It might be best to be a bit more descriptive as to what you're actually after. – Adam Cameron Oct 26 '12 at 13:14
3

Unlike datasources, mail servers are used automatically - you don't need to specify them.

However, you can also supply the assorted properties for a mail server directly as attributes on a cfmail tag, which then overrides those in the administrator for that instance only.

(If this isn't what you're asking, you need to edit your question to clarify and add more information.)

Peter Boughton
  • 110,170
  • 32
  • 120
  • 176
  • You are right. But for some reason, I have to programmatically know that what Mail Server settings have been specified in my CfAdmin. I was wondering if there is a way to read CFAdmin settings in my code. – Adil Malik Oct 26 '12 at 14:16
  • 2
    _"for some reason"_ makes no sense - there's either an explicit reason or there isn't - but Adam's answer indicates how to retrieve the settings stored in the Administrator. – Peter Boughton Oct 26 '12 at 14:28
  • @AdilMalik This does not make sense to me either. If you know you will need to dynamically specify the mail server in the code then just supply the attributes in your code as Peter suggested instead of trying to read the admin settings. – Miguel-F Oct 26 '12 at 15:12