What's wrong with this cfmail header?

dbabbitt
dbabbitt used Ask the Experts™
on
Hi Guys!

What's wrong with this email header:


x-cf-version: 4.5.0
x-cf-server: localhost
x-cf-port: 25
x-cf-timeout: 60
x-cf-from: http://www.clipboardsolutions.net/_PM/time/add_time_entries_form.cfm@www.clipboardsolutions.net
x-cf-to: dbabbitt@clipboardmail.net

Content-type: text/html

Date: Mon, 25 Nov 2002 11:06:00 -0500

From: http://www.clipboardsolutions.net/_PM/time/add_time_entries_form.cfm@www.clipboardsolutions.net

Subject: 'options[...]' is null or not an object

To: dbabbitt@clipboardmail.net


I'm trying to do cfmail like this:


<cfparam name="MailToAddress" default="dbabbitt@clipboardmail.net">
<cfscript>
     EmailSubject = "You've Thrown an Unknown Error";
     if(IsDefined('CFCATCH.Type') AND Len(Trim(CFCATCH.Type))) {
          EmailSubject = "You've Thrown an " & Trim(CFCATCH.Type) & " Error";
          }
     if(IsDefined('URL.MSG') AND Len(Trim(URL.MSG))) {
          EmailSubject = Trim(URL.MSG);
          }
     if(IsDefined('URL.ERRURL') AND Len(Trim(URL.ERRURL))) {
          EmailFrom = Trim(ListFirst(URL.ERRURL, '?'));
          }
     else {
          EmailFrom = Trim(CGI.SCRIPT_NAME);
          }
     EmailFrom = EmailFrom & "@" & CGI.HTTP_HOST;
</cfscript>

<CFMAIL
     TO="#MailToAddress#"
     FROM="#EmailFrom#"
     SUBJECT="#EmailSubject#"
     TYPE="HTML"
>

but all I'm getting is a bunch of undeliverables.

Thanx

Dave
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
Doesn't look to me like a coding error.  By undeliverable do you mean that you are getting files dropped into your \cfusion\mail\UnDelivr directory?  Are you sure you have your SMTP defined properly?  Are you sure the SMTP server is allowing your connection to relay mail??

Author

Commented:
It used to work until I changed the EmailSubject and the EmailFrom variables.

Commented:
U havent user the MAilserver option in ur CFMAIL

so i suppose u have defined it in the CF-Admin

just to cross chk thats all - cos things seem to eb fine with the code

let me know

K'Rgds
Anand
Bootstrap 4: Exploring New Features

Learn how to use and navigate the new features included in Bootstrap 4, the most popular HTML, CSS, and JavaScript framework for developing responsive, mobile-first websites.

Commented:
it should work. it is undeliver  because of not a valid email id.
just check what is the value of MailToAddress, EmailFrom, EmailSubject before it has been assign to cfmail header.

<cfoutput>
  To : #MailToAddress#<br>
  From : #EmailFrom# <br>
  Sub :  #EmailSubject#
</cfoutput>

check is it valid mail id.
<CFMAIL
    TO="#MailToAddress#"
    FROM="#EmailFrom#"
    SUBJECT="#EmailSubject#"
    TYPE="HTML"
>

Commented:
Everything else is fine Except the EmailFrom Thing.

When sending Emails from CF, its important that a Proper 'FROM' is used

Examples Valid ones are

joe@joebloggs.com
joe@joebloggs.com<Joe Bloggs>

What you are sending is a URL in 'FROM' field which is definitely invalid.

HTH
Jimmy
I don't think you can do cfscript in cfmail.

The simpler it is the more reliable it is.

Commented:
Keep your 'C' Grade with you.
I dont understand why people give 'C' grades.
Call the community support to unlock this question.
I dont want these points. You keep them.

Author

Commented:
This is where the Experts Exchange system breaks down. No one answered this question before I figured it out myself and it's just too much trouble to retract my question. The proper answer is that there are certain characters that are not allowed in the From field. Yours was the closest answer, but it wasn't satisfactory and it wasn't quick enough. If everybody gets an "A", then the "A" no longer has any meaning.

From now on the cost of question maintenance will being taken at the expense of the commentors.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial