Link to home
Start Free TrialLog in
Avatar of dbabbitt
dbabbitt

asked on

What's wrong with this cfmail header?

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
Avatar of RockerNJ
RockerNJ

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??
Avatar of dbabbitt

ASKER

It used to work until I changed the EmailSubject and the EmailFrom variables.
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
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"
>

ASKER CERTIFIED SOLUTION
Avatar of jimmy282
jimmy282
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I don't think you can do cfscript in cfmail.

The simpler it is the more reliable it is.

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.
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.