Hi,

I've set up a "Send Page to Friend" function using a script that I donwloaded.

It works fine if I use my email as the recipient address, but I receive the following error when I try to send it to a Yahoo address:

Invalid Addresses; nested exception is: class javax.mail.SendFailedException: 550 5.7.1 <blahblah@yahoo.com>... Relaying denied. IP name lookup failed

I'm able to send a regular email to Yahoo through our mail server, so I'm wondering if the error is coming from the Yahoo mail server because I'm submitting a form? Is there a better way to create a "send page to friend" function other than cfmail?

Thank you!

What sender address are you using? It sounds like its being rejected, possibly as an anti-spam measure. Though I don't know if its from your mail server or from yahoo. Check their faq's http://help.yahoo.com/l/us/yahoo/mail/original/abuse/basics-55.html

Personally I use a regular <a href="mailto:..."> link instead of cfmail. I'd rather emails are sent through the user's email client instead of my mail server. That way I don't have to worry about rejected emails or people sending spam through my application. The disadvantage of using "mailto:" is that the user cannot send email unless they have a web client like outlook, etc installed.

I agree with you, CFAllie. But now I have another problem! When I try to include the URL, including a query string, in the body of the message, it won't include anything with ? or &. I tried setting the variable for the link and then including the variable in the body, but it doesn't work for me.

Thanks!

I'm not sure exactly how you're coding it. You might look into the JSStringFormat() function.

Also check google for tips on obscuring/generating mailto: links to prevent harvesting /spamming.

Hi,

Thanks for all your good advice. I've given up on the query string part. We're just going to email from pages without query strings.

Here's the code:
<CFSET pagename = cgi.script_name>
<cfoutput>
<a href="mailto:?subject=Look at this information on #variable.blahblah# &body=http://www.#pagename#">Send this page to a friend</a>
</cfoutput>

Do I need to worry about harvesting /spamming if the mailto: is blank?

Thanks again!

I didn't test it but I think something like this should work

<cfset blahblah = "whatever site" />
<cfset subjectText = "Look at this information on #blahblah#" />
<cfset linkText = "http://www.domain.com#cgi.script_name#">
<cfif len(cgi.query_string)>
    <cfset linkText = linkText &"?"& URLEncodedFormat(cgi.query_string) />
</cfif>

<cfoutput>
<a href="mailto:?subject=#subjectText#&body=#linkText#">Send this page to a friend</a>
</cfoutput>

A blank mailto: is good. Harvesting/spam are only an issue if the mailto: contains a real email address.

So that worked great...until my coworker tried to open the link with Lotus Notes! Apparently, the body turns up in the subject line. Any other alternatives that you know of?

Thanks you!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.