Problems with CFMail
Copy link to clipboard
Copied
Dear Colleagues,
I rarely post because CF is, by and large, so friendly and easy to use. But, I have a problem which is quite vexing. The following code accepts information from a form, performs a query and is then supposed to generate an email to the customer (client name changed). We have verified that (1) CFmail is working, generically from the hosted site but only if the addresses are hard-coded into the script; (2) The form is passing data correctly since the query performed just prior to CFMail works exactly as scripted and the form information prints correctly to html. (3) The code, when transferred to another site on the same ISP works as scripted. (4) Cold Fusion is not returning any errors.
This has been driving the development team absolutely crazy and the ISP techs don't seem to have an answer, either. Any and all thoughts are most appreciated. The code:
<CFoutput>
<CFset dj_stock_id = #form.dj_stock_id#>
<Cfif #len(form.sendname)# EQ 0>
<CFset zresult = 0>
<CFelseif #len(form.sendmail)# EQ 0>
<CFset zresult = 1>
<CFelseif #len(form.dayphone)# EQ 0>
<CFset zresult = 2>
<CFelseif #find('@',form.sendmail)# EQ 0>
<CFset zresult = 3>
<CFelseif #len(form.location)# EQ 0>
<CFset zresult = 5>
<CFelse>
<CFset zresult = 4>
<CFset todaydate = #Now()#>
<CFquery name = "makereserve" datasource = "diannesnew">
update dj_products
set dj_products.dj_stock_status = 2,
dj_resdate = #todaydate#
where dj_products.dj_stock_id = #getall.dj_stock_id#
</CFquery>
<CFmail server="mail.xxxx.com"
username="customer@xxxx.com"
password="ddddl"
from="#form.sendname# <customer@xxxx.com>"
to="alex@diannesestatejewelry.com"
cc="#form.sendmail#"
bcc="nnn@xxxx.com,ddd@dxxxx.com"
replyto="#form.sendmail#"
failto="dr_data_1@yahoo.com"
subject="Reservation Request for #getall.dj_stock_name# "
type="html">
Reservation Request for <strong>#getall.dj_stock_name# </strong><br /><br />
Name: #form.sendname#<br />
Email: #form.sendmail#<br />
Daytime Phone: #form.dayphone#<br />
<CFif #len(form.altphone)# GT 0>
Cell Phone: #form.altphone#<br />
<CFelse>
</CFif>
Today's Date: #DateFormat(now(), 'mm/dd/yyy')#
Item Reserved:
#getall.dj_inventory#<br />
#getall.dj_stock_name#<br />
Location: #form.location#
<br />
<pre>#form.mymessage#</pre><br />
<p>Please contact this person by close of business on #DateFormat(now()+1, 'mm/dd/yyyy')#</p>
</CFmail>
</CFif>
</cfoutput>
Copy link to clipboard
Copied
What's in the log files ? (mail.log especially) Also, check that the
Mail/Spool and Mail/Undelivr directories have no files in them (files
in Mail/Undelivr are e-mails that CF had problems delivering and
you'll usually find more info about each file in the log file).
Mack

