Site maintenance: Sun 15 Nov, from 12:00 UTC, about 4–6 hours. Details

This cutover relies on some testing that is still incomplete so may be cancelled at short notice

Forums / General Questions / Trying to add custom link to welcome email

Trying to add custom link to welcome email

Locked

Started by doodlebee on 10 Apr 2007, 8:41 PM · Views: 2,076

Results 1 to 9 of 9
This thread is locked. New replies are disabled.
10 Apr 2007, 8:41 PM
#1
doodlebee avatar

doodlebee

Inactive

Join Date:
Jan 2006
Posts:
228
Plugin Contributions:
0

Trying to add custom link to welcome email

Hey all - I want to add in a custom link to my welcome email message. However, when I do, the message comes through just fine, but the link doesn't show.

Meaning, I enter it in the file like so:

Click <a href="http://site.com/filename">this link</a>.

and the email comes through as

Click this link.

"this link" is regular text, not linked text.

I've edited includes/languages/english/create_account/php. I tried adding a definition with the URL in that and applying it to the line in question, but it still strips the link. This is what I have so far:

define('EMAIL_FREE_DOWNLOAD', '<a href="http://www.site.com/download/download.zip">link</a>');

// First line of the greeting
define('EMAIL_WELCOME', 'We wish to welcome you to <strong>' . STORE_NAME . '</strong>.  For becoming a new customer, we would like to give you a small token of appreciation.  Please visit our site ' . EMAIL_FREE_DOWNLOAD . ' to download a free screensaver - an animated work of art to decorate your desktop when you are away, featuring many of the artist\'s favorite images.');

Would anyone know what I need to do to have the link actually show up as a link, instead of as plain text?

11 Apr 2007, 7:09 AM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: Trying to add custom link to welcome email

If you go to Admin->Tools->Welcome Email does the link appear as clickable ?
If so, then Zen Cart is building the clickable link as intended but your email client is removing the hotlink.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

11 Apr 2007, 11:17 AM
#3
doodlebee avatar

doodlebee

Inactive

Join Date:
Jan 2006
Posts:
228
Plugin Contributions:
0

Re: Trying to add custom link to welcome email

If you go to Admin->Tools->Welcome Email does the link appear as clickable ?

Nope - it's not.

What's funny is, there are three other links in the email that are clickable. They don't appear to be so in the preview (they show up as plain text in the preview) so I had assumed that it just didn't show that in the preview. But I've registered myself twice, and the links that are laready there are still clickable (when I get the actualy email) but the one I've created is not.

11 Apr 2007, 6:54 PM
#4
doodlebee avatar

doodlebee

Inactive

Join Date:
Jan 2006
Posts:
228
Plugin Contributions:
0

Re: Trying to add custom link to welcome email

Aha!

I had to remove the "http://" from the link. Now it works just fine n' dandy.

Wonder why that is?

Oh well - it works now!

17 Apr 2007, 6:40 PM
#5
doodlebee avatar

doodlebee

Inactive

Join Date:
Jan 2006
Posts:
228
Plugin Contributions:
0

Re: Trying to add custom link to welcome email

Scratch that. Apparently it's not working anymore. It makes no sense. I tested it out several times that day, and it worked just fine. Now the client comes back with "it's not working" - so I test it again, and by God, it's not.

Makes absolutely no sense. Why would it work, and then just suddenly stop working?

Why can't I add a single link to the email welcome message?

17 Apr 2007, 11:38 PM
#6
theoracle avatar

theoracle

Suspended

Join Date:
Aug 2004
Posts:
3,180
Plugin Contributions:
1

Re: Trying to add custom link to welcome email

Replace:

define('EMAIL_FREE_DOWNLOAD', '<a href="http://www.site.com/download/download.zip">link</a>');

with:

define('EMAIL_FREE_DOWNLOAD', '<a href=\'http://www.site.com/download/download.zip\'>link</a>');

This should resolve this problem. :wink2:

18 Apr 2007, 12:52 AM
#7
doodlebee avatar

doodlebee

Inactive

Join Date:
Jan 2006
Posts:
228
Plugin Contributions:
0

Re: Trying to add custom link to welcome email

Thanks Oracle. But no go.

I've tried I don't know how many variations on this, and it's just not taking. At one point, I even tried:

define('EMAIL_FREE_DOWNLOAD', 'http://www.site.com/download/download.zip'); 

// First line of the greeting
define('EMAIL_WELCOME', 'We wish to welcome you to <strong>' . STORE_NAME . '</strong>.  For becoming a new customer, we would like to give you a small token of appreciation.  Please visit <a href="' . zen_href_link(EMAIL_FREE_DOWNLOAD) . ' ">this link</a> to download a free screensaver - an animated work of art to decorate your desktop when you are away, featuring many of the artist\'s favorite images.');

...just to see if the "zen_href_link" thing was required to set a URL. I just don't understand why there are two other links in this file that work fine:

define('EMAIL_CONTACT', 'For help with any of our online services, please email the store-owner: <a href="mailto:' . STORE_OWNER_EMAIL_ADDRESS . '">'. STORE_OWNER_EMAIL_ADDRESS ." </a>\n\n");

define('EMAIL_GV_CLOSURE','Sincerely,' . "\n\n" . STORE_OWNER . "\nStore Owner\n\n". '<a href="' . HTTP_SERVER . DIR_WS_CATALOG . '">'.HTTP_SERVER . DIR_WS_CATALOG ."</a>\n\n");

both produce 1) a link to the site owner's email address and 2) a link to the site itself. My emails are set to text-only - but still those links come through just fine.

Do I need to set the link in some other file first? Possibly somewhere in another folder? Custom defines, maybe? I just don't understand why I can't just simply place a hard-coded link in this one file. It's really weird.

18 Apr 2007, 7:41 PM
#8
theoracle avatar

theoracle

Suspended

Join Date:
Aug 2004
Posts:
3,180
Plugin Contributions:
1

Re: Trying to add custom link to welcome email

This should work:

define('EMAIL_FREE_DOWNLOAD', 'http://www.site.com/download/download.zip'); 

// First line of the greeting
define('EMAIL_WELCOME', 'We wish to welcome you to <strong>' . STORE_NAME . '</strong>.  For becoming a new customer, we would like to give you a small token of appreciation.  Please visit <a href=\"' . zen_href_link(EMAIL_FREE_DOWNLOAD, '', 'NONSSL') . ' \">this link</a> to download a free screensaver - an animated work of art to decorate your desktop when you are away, featuring many of the artist\'s favorite images.');

This one is a first time modified, tell me if it does work. :wink2:

define('EMAIL_CONTACT', 'For help with any of our online services, please email the store-owner: <a href=\"mailto:' . STORE_OWNER_EMAIL_ADDRESS . '\">'. STORE_OWNER_EMAIL_ADDRESS .' </a>\n\n');

define('EMAIL_GV_CLOSURE','Sincerely,"\n\n"' . STORE_OWNER . '"\nStore Owner\n\n<a href=\"' . HTTP_SERVER . DIR_WS_CATALOG . '\">'.HTTP_SERVER . DIR_WS_CATALOG.'</a>\n\n');
18 Apr 2007, 9:48 PM
#9
doodlebee avatar

doodlebee

Inactive

Join Date:
Jan 2006
Posts:
228
Plugin Contributions:
0

Re: Trying to add custom link to welcome email

Well, much to my surprise...it didn't work. ;)

I've given up and found an alternate method to solve the problem. What we were trying to do was put in a link for a free download - but it just wouldn't take the link. So what I did was put a link in the tpl_account_default page. So everyone is happy.

Now, it was brought to my attention (somewhere else) that the possible reason for the link being stripped in the email was because... well, I'll quote what they said so you can see it - maybe you can make more sense of it than I can. I get what she's saying, but she says it better than I ever could!

I quote:

Every email is sanitized, I was just checking out the code and in:

includes\functions\functions_email.php line line 224, you will see:

$email_subject = zen_db_prepare_input($email_subject);

That zen_db_prepare_input is what prevents sql injections and all that stuff... maybe there's a way to check if it's the welcome email and not sanitize it... there is a $module field passed, so it might be possible...

So it sounds like it's made to be stripped on purpose. If this is true, then I would suggest perhaps a better way to handle things like this in a future release? I understand the need for changing the email welcome is supplied, but I think if people want to add extra links or something to it, they shouldn't have an issue like this.

When I get less busy, I plan to follow on this lead and see if what she says holds true - perhaps it is stripped because ZenCart is set to strip it. I'd like to play and see what I find out.