Cfadmin action="updateMailServer" errors

Docker image lucee/lucee:5.3-nginx running on AWS Fargate
tomcat9.0
jdk11-openjdk
lucee:5.3.4.80

cfadmin is no longer working for updateMailServer. This is needed for automation for my CI/CD pipeline. This the error message: “Can’t cast Null value to value of type [number]”. Any ideas?

This is the my cfadmin tag. BTW the <cfadmin action="getMailServers" show and empty query. Any help would be appreciated.

<cfadmin 
  action="updateMailServer" 
  type="server" 
  password="#server.system.environment..admin_password#" 
  hostname="email-smtp.us-east-1.amazonaws.com" 
  dbusername="#server.system.environment..ses_us_east_1_dbusername1#" 
  dbpassword="#server.system.environment..ses_us_east_1_dbpassword1#" 
  port="587" tls="true" ssl="false" remoteClients="">

I use this the view may newly entered mail server…

<cfadmin action="getMailServers" type="server" password="xxxxx" returnVariable="ms1">
<cfdump var="#ms1#">

I would love to see any snippet of that that works with these tags.

Thanks again!
– Bill

Isolation test suggest it’s the port. Any ideas?

Remove <> because code would not show…

<cfadmin action="updateMailServer" type="server" password="xxxxxxxx" hostname="email-smtp.us-west-2.amazonaws.com" dbusername="xxxxxxxxxxxxxxxxxxx" dbpassword="xxxxxxxxxxxxxx" port=587 id=0 tls=true ssl="false" remoteClients="">

<cfadmin
    action="getMailServers"
    type="server"
    password="123456"
    returnVariable="ms1"
    cfdump var="#ms1#">

Or use the code tag of the editor for better display/reading:

<cfadmin
action=“getMailServers”
type=“server”
password=“123456”
returnVariable=“ms1”/>
<cfdump var="#ms1#"/>
1 Like

thx

1 Like

BTW how is Fargate working out for you as a deployment environment?

Works great. I can pass env vars for db… except mail. Autoscale and startup works great. I can share my experience and help if you like… Below is a screen shot of my lucee services running behind an ALB.

– Bill

Looks like a little more security may be needed. Check out the scan on the container… Not bad but could be a little bit better…

1 Like

Testing with the latest snapshot 5.3.5.87-SNAPSHOT-light-nginx

Upgrade to latest and cfadmin action=“updateDatasource” errored out…

If anybody know how to config the mail server using cfadmin I would love to see their code. Thanks in advance.

Docker image lucee/lucee:5.3-nginx running on AWS Fargate
tomcat9.0
jdk11-openjdk
lucee:5.3.4.80

– Bill

You could always set the default server via the Application.cfc using this.mails or set the default cfmail tag attributes via environment variables in the container:

Default Mail Server

this.mails =[

        {
          host: 'mailgate4.mysite.com'
        , port: 25
        , username: ''
        , password: ''
        , ssl: false
        , tls: false
        , lifeTimespan: createTimeSpan(0,0,1,0)
        , idleTimespan: createTimeSpan(0,0,0,10)
        }

    ];

CFMAIL default attributes

<cfif structKeyExists(THIS, "bUseEnv") AND THIS.bUseEnv eq "true">
    <cfset system = createObject("java", "java.lang.System")>
    <!--- // SMTP Server Settings  --->
    <cfset SMTP_SERVER = "" & system.getEnv("SMTP_SERVER")>    
    <cfif len(SMTP_SERVER)>
        <cfset THIS.tag.mail.server = system.getEnv("SMTP_SERVER")>
        <cfset THIS.tag.mail.port = system.getEnv("SMTP_PORT")>
        <cfset THIS.tag.mail.username = system.getEnv("SMTP_USERNAME")>
        <cfset THIS.tag.mail.password = system.getEnv("SMTP_PASSWORD")>
    </cfif>
</cfif>
1 Like

thx will try this way…

Try the cfc way. Did not work… (Is unit testing in the deployment pipeline?)

Any ideas would be welcomed.

Love to see working code… I had working code for using the mail server in railo but no longer works in lucee.

This no longer works.

Pretty simple…

I would love the see the unit test results for the cfadmin tag.

– Bill

component {
	this.name = "lucee_context#server.lucee.version#";
        this.clientmanagement="no";
        this.clientstorage="file";
        this.scriptprotect="all";
        this.sessionmanagement="yes";
        this.sessionStorage="memory";
        this.sessiontimeout="#createTimeSpan(0,0,30,0)#";
        this.setclientcookies="yes";
        this.setdomaincookies="no";
        this.applicationtimeout="#createTimeSpan(1,0,0,0)#";
        this.localmode="update";
        this.web.charset="utf-8";
        this.scopeCascading="strict";

        this.mailservers =[ 

		    {
		      host: 'email-smtp.us-west-2.amazonaws.com'
		    , port: 587
		    , username: 'xxxxxxx'
		    , password: 'xxxxxxx'
		    , ssl: false
		    , tls: true
		    , lifeTimespan: createTimeSpan(0,0,1,0)
		    , idleTimespan: createTimeSpan(0,0,0,10)
		    }

			];

	// dump( this );abort;

}

I was not able to get this to work… Any other ideas? Did you run this on the latest release?

@utiliware, I checked this one in my local and YES, the issue is there. Because the attributes “life” and “idle” timespans are needed to check action “updateMailServer”. Could you please give both the timespan for updating mailserver.
I hope this will help to you.

1 Like

Please cut and past sample code.

Please test with this

<cfadmin 
    action="updateMailServer"
    type="server"
    password="xxxxxxx"
    hostname="email-smtp.us-east-1.amazonaws.com"
    dbusername="xxxxxxxx"
    dbpassword="xxxxxxxx"
    port="587"
    id="0"
    tls="true"
    ssl="false"
    life="#createTimeSpan(0,0,1,0)#"
    idle="#createTimeSpan(0,0,0,10)#"
    remoteClients="">

testing now…

THANK YOU!!! This worked!!!

Please update documentation (DOES NOT WORK)

<cfadmin
    action="updateMailServer"
    type="web|server"
    password="password"
    hostname="#data.hosts[idx]#"
    dbusername="#data.usernames[idx]#"
    dbpassword="#data.passwords[idx]#"
    port="#data.ports[idx]#"
    tls="#isDefined("data.tlss[#idx#]")anddata.tlss[idx]#"
    ssl="#isDefined("data.ssls[#idx#]")anddata.ssls[idx]#"
    remoteClients="arrayOfClients">
    action="removeMailServer"
    type="web|server"

to

<cfadmin 
    action="updateMailServer"
    type="server"
    password="xxxxx"
    hostname="xxxxx"
    dbusername="xxxxxx"
    dbpassword="xxxxxx"
    port="587"
    id="0"
    tls="true"
    ssl="false"
    life="#createTimeSpan(0,0,1,0)#"
    idle="#createTimeSpan(0,0,0,10)#"
    remoteClients="">

THIS WORKS.