PDA

View Full Version : How to use your domain's mail server with cfmail



jakeh
August 2nd, 2011, 04:37 PM
When using your domain's mail server with the ColdFusion cfmail tag, you'll have to specify the mail server details as follows:


<cfset mailAttributes =
{
server="mail.yourdomain.com",
username="[email protected]",
password="emailpass",
from="[email protected]",
to="[email protected]",
subject="Sent from ColdFusion"
} />

In the above code, you will change the "username" and "from" values to your full email address. The "password" should be the password for the email account you specified. Be sure to change the "to" and "subject" values according to your needs. Also, be sure to replace mail.yourdomain.com with the actual hostname for your mail server.

Now we need to implement the cfmail tag, using our attributeCollection:


<cfmail port="25" useSSL="false" attributeCollection="#mailAttributes#">
This email was sent over port 25 with SSL disabled.
</cfmail>

Note, if you wish to send mail using SSL, change the port to 25 and set 'useSSL' to 'true'.