Coldfusion CFMAIL and sendgrid

前端 未结 2 792
醉梦人生
醉梦人生 2021-01-19 03:10

I have 2 clients on the same server that I host, that both send email through sendgrid.com (both have their own accounts).

I was looking at reports on sendgrid and n

相关标签:
2条回答
  • 2021-01-19 03:40

    I don't know what version of ColdFusion you are running but in ColdFusion 9 a new feature was added that allows you to specify the SMTP server settings in your Application.cfc file. Assuming that you have separate Application.cfc files for your 2 sites then perhaps this will work for you.

    Here is a reference to the new feature in ColdFusion 9

    Here is the text from that referenced page.

    Problem
    How can I use the different SMTP Server Settings for Applications hosted in ColdFusion server for sending Email.

    Solution
    By using the new ColdFusion 9 “smtpServersettings" feature in Application.cfc file, we can specify different SMTP server settings for Applications.

    Detailed explanation
    ColdFusion 9 added a new attribute called "smtpServersettings" to the Application.cfc file. We can specify the SMTP server setting details to "smtpServersettings" attribute of THIS scope in Application.cfc which takes three values and they are server, username and password as a structure.

    <cfcomponent displayname="CF9ApplicationVariables" output="false">
    
       <cfset this.name   = "CF9ApplicationVariables" />
       <cfset this.smtpserversettings   = {
                              server="mailServerAddress",
                              username="userEamilID",
                              password="userPassword"
                              } />
    </cfcomponent>
    

    Now the CFMail tag will use the server details for sending mails as mentioned above in "smtpServersetting" in Application.cfc and it won't use the server values specified in the ColdFusion 9 Administrator. If "smtpServersetting" attribute is not used then CFMail will behave as normally.

    0 讨论(0)
  • 2021-01-19 03:50

    I ended up modifying the DNS settings in my servers, adding a cname that pointed to the smtp address, smtp.sendgrid.net. I then updated my code to use the new server names, and this seems to be separating the connections.

    0 讨论(0)
提交回复
热议问题