CFMAILPARAM Sender

September 7th, 2007

I’m writing this to hopefully allow other people to avoid the issues I’ve had with one of the sites I support. This particular client’s business revolves around sending emails so it is obviously important that the end user receive those emails. Spam filters are more and more getting in the way. One thing you have to really think about when sending the email is “What will this email look like to the receiving server?” If you are on domain.com and you send an email using cfmail and the from address is a domain.com address, there is no problem. It’d be like sending that same message through Outlook using a domain.com address and domain.com relay (SMTP) server.

What if you have a form allowing a random user to send an email?This is where SPF filtering can block your message. They put in their from email address and to email address and whatever other data and that information gets stuck into the cfmail tag. Now, you might have an email address FROM someone@from.com TO someone@to.com. The email was sent THROUGH the domain.com server. Now if to.com’s server acknowledges SPF filtering, it will look at the dns record for from.com and look specifically at the TXT record. A smart DNS entry will list IP addresses that are able to send email. If the IP address of domain.com’s mail server does not appear in the DNS record of to.com, then the message will be blocked.

Here’s an example of the TXT record from domain.com:

domain.com       86400   IN         TXT       "v=spf1 ip4:xx.xx.xx.xx ip4:yy.yy.yy.yy ip4:zz.zz.zz.zz -all"

The first 3 ip addresses would be valid mail servers. The –all says to reject anything that is not one of those 3 ip addresses.

The way around this is to use a cfmailparam tag with a valid email address for domain.com (make an email address if necessary like info@domain.com). Here’s what the resulting code looks like:

<cfmail to="#to#"  from="#from#" subject="#subject#" type="html">
<cfmailparam name="sender" value="valid_email@domain.com">
.
.
.
</cfmail>

I hope this helps some people out

Farcry Images in Containers

September 7th, 2007

For whatever reason, the default install of Farcry (I’m using FC 3.0.2) does not allow you to add images to containers. This is extremely easy to fix.

The Handpicked Rule looks at all types installed in COAPI Management and checks for the flag bScheduled=”1″. dmImage does not have that by default. So, to fix this, extend dmImage. dmImage.cfc goes in /farcry/project/packages/types/. The contents of dmImage.cfc are:

<cfcomponent extends="farcry.farcry_core.packages.types.dmImage"
          displayName="Images"
          bSchedule="1"
          bUseInTree="0">

</cfcomponent>

It’s as easy as that!

Farcry dmCSS How-To

August 6th, 2007

I’ve been developing using Farcry for nearly a year now and the dmCSS type has always puzzled me. I knew it had to be a way to have node-specific CSS but how do you use it? I finally took the time to learn how and here’s what I found.

Read the rest of this entry »

CSS close window link

July 31st, 2007

Honestly, I am blogging this to satisfy a coworker (Axel) who thought this was really cool.

You see this kind of thing all the time, a little X on a window that gets open that allows you to close it. Not the X close button on the title bar of the window but a little close link with an x. I’m a bit of a CSS geek so I made this in CSS. Here’s the code:

<a href="Javascript:window.close()" style="text-decoration:none;">close <span style="border:1px solid gray;width:15px;text-align:center;font-size:8pt;cursor:hand;">X</span></a>

Test It!

Nice Weather Sucks For Work!

July 19th, 2007

Nice weather really sucks for work. I mean, there’s nothing that I love more than a good 80 degree day when the sun is shining and people are out and about. It’s days like today that I wish I was an insomniac. I know, I should be careful what I wish for, but follow my logic here. Insomniacs don’t sleep. Programmers write code and rarely talk to customers (at least that’s how I do it :). If I was an insomniac, I could write code when everyone else is sleeping and be out and about all day. What a life that would be…

Farcry Snippets

July 18th, 2007

What are snippets you ask? Just a little something I came up with to make my life and the lives of my clients easier.

DISCLAIMER: I set this up using FC 3.0.2. I do not know how it may function on FC 4.

I have set up a lot of sites that have little random pieces of content here and there. Usually I end up making a custom rule or sometimes a custom type to handle each piece of content. Bigger sites, however will end up with several custom pieces, each of which requires the client to do things just right.

Let’s face it, remembering a password is hard enough for some people, let alone managing multiple containers each with a different content type. My solution? Snippets.

A snippet is a data type (jcSnippet) that is similar to a dmNews object only stripped down. The most important piece is the body and the use of the WYSIWYG editor and the image/file/link inserters. The link inserter is also custom. You can see other posts about it on my blog.

Essentially what will happen is the user will create a snippet (some HTML) that will get dumped into a container. This will allow the users to completely customize container content when necessary using the WYSIWYG editor of your choice.

Read the rest of this entry »

Farcry Custom Widgets

July 18th, 2007

This is a quick how-to for custom widgets. Widgets can be a really powerful tools if used correctly. I recently found a really good use for them so here is an explanation of how to create them and use them. Enjoy!

Create a folder path inside your project folder that looks like this: /farcry/project_name/tags/widgets. This will hold any custom widgets. I’ve blogged about this before but we are going to create a link inserter widget. Create a file inside the folder you just made called whatever you want (I’m using bodyInsertLink.cfm). Here’s the code:

<cfoutput>
	<cfquery name="getHTMLPages" datasource="#application.dsn#">
		SELECT	label,objectid
		FROM	dmHTML
		WHERE	status = <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="approved">
		UNION
		SELECT	label,objectid
		FROM	dmInclude
		WHERE	status = <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="approved">
		ORDER BY label ASC
	</cfquery>

	<script type="text/javascript" language="JavaScript">
		function getLinkValueInsert()
		{
			objSelect = document.getElementById("links");
			tempStr = objSelect.options[objSelect.selectedIndex].value;
			arVal = tempStr.split("|");
			oID = arVal[0];
			label = arVal[1];
			//alert(tempStr+"\\n"+oID+"\\n"+label);
			if(!oID || !label)
				alert("Please select a valid link to insert.");
			else
				insertHTML('<a href="#application.url.conjurer#?objectid='+oID+'">'+label+'</a>');
			return false;
		}
	</script>

	<div class="relateditems-wrap" style="margin-left:30px;">
		<h2>Links</h2>
		<select name="links" id="links" size="3">
			<cfloop from="1" to="#getHTMLPages.recordcount#" step="1" index="i">
				<option value="#getHTMLPages.objectid[i]#|#getHTMLPages.label[i]#">#getHTMLPages.label[i]#</option>
			</cfloop>
		</select>
		<div class="f-submit-wrap">
			<input type="button" name="buttonInsertLinkInBody" value="Insert in body" class="f-submit" onclick="return getLinkValueInsert();" />
		</div>
	</div>
</cfoutput>

Read the rest of this entry »

UPDATE: Better Link Inserter for FC 3

July 18th, 2007

This is an update to a post I wrote a couple months ago regarding link insertion into the body of content objects: http://jake.cfwebtools.com/2008/02/29/farcry-insert-link-to-other-dmhtml-objects/. I’d like to formally apologize for my ignorance when writing that post. Please ignore it :).

The problem was that the site tree and the body editor are in two different iFrames causing focus to be lost when clicking on the site tree to try to insert a link. I had a brilliant idea (so I thought) to edit the core files of farcry to fix this. It worked fine, but hey, you had to edit the core files of Farcry. THIS IS NOT A GOOD IDEA! Here’s a better idea…

Read the rest of this entry »

Farcry Insert Link to other dmHTML objects

May 1st, 2007

I want to preface this by saying you probably should not do this. Having contradicted myself, I’d also like to say that this is really cool!

You may have noticed that when editing an HTML page it is possible to right click on any other page in the site tree and use the “insert” function which will insert a link directly into the editor to that page. Pretty handy right? Well there is an issue with this in that the site tree is in a different iFrame than the editor so the position in the WYSIWYG editor is lost and the link gets inserted at the very top of the page no matter what. (I’ve seen this more so in IE7 than anything else). This is annoying and is not very friendly for a lot of clients because they then have to copy and paste that link somewhere else. If there is a lot of formatting in the page, sometimes this can get altered when copying and pasting so I wanted a better solution.

Warning! This required a change to a couple of core files so if you are up to that click through to read more. If not, there is a pretty “X” in the top right of your window. Click it now :)

Read the rest of this entry »

CSS Browser Hacks

May 1st, 2007

I searched for a long time on how to hack different browsers in CSS so I thought I’d post techniques for the 3 most popular browsers (IE6, IE7 & Firefox).

The Technique:

I strongly recommend writing CSS and testing it in Firefox. Get it to look right, then hack out IE6 & IE7. Nothing against any of the browsers but this has been the most effective technique for me. You will usually need to make several adjustments to widths and heights, padding and margints, etc in IE6 and IE7 should follow pretty much what Firefox does. There are a few exceptions like floating and positioning that I’ve found.

Read the rest of this entry »