Answered
validating email
Hello, I have a program that loops over a comma delimited
list of email addresses to send out our newsletters. I am running
into the problem with CF MX that if it reaches a bad email it will
crash the program and throw an error.
Does anyone know how I could go about validating the email accounts, or weed out the bad ones before I run the code to send out? Here is how I send out the mail:
<cffile action="read"
file="#ExpandPath('contacts.txt')#"
variable="contacts">
<!---loop over the list and send an email to each address--->
<cfloop list="#contacts#" index="idx" delimiters=",">
<cfmail to="#idx#"
from="#Form.MessageFrom#"
subject="#FORM.messageSubject#" type="html">
#form.message#
</cfmail>
Sending to... <cfoutput>"<strong>#idx#</strong>"<br>
</cfoutput>
</cfloop>
Does anyone know how I could go about validating the email accounts, or weed out the bad ones before I run the code to send out? Here is how I send out the mail:
<cffile action="read"
file="#ExpandPath('contacts.txt')#"
variable="contacts">
<!---loop over the list and send an email to each address--->
<cfloop list="#contacts#" index="idx" delimiters=",">
<cfmail to="#idx#"
from="#Form.MessageFrom#"
subject="#FORM.messageSubject#" type="html">
#form.message#
</cfmail>
Sending to... <cfoutput>"<strong>#idx#</strong>"<br>
</cfoutput>
</cfloop>
