bug in tell_a_friend.php email and general email note
mandreiana <[email protected]>
| Newsgroups | gmane.comp.web.oscommerce.devel |
|---|---|
| Message-ID | <f3f2de33b342b82302fa05b355e264e9@osCommerce-Forums> |
This message was sent from: Development
http://forums.oscommerce.com/viewtopic.php?p=160014#160014
----------------------------------------------------------------
When osc is set to send HTML emails, tell_a_friend has 2 bugs:
* all email is in one line. nl2br() should be added to email_body as in create_account_process.php.
* the link which should be clicked it's not clickable in the received mail.
Both are fixed below:
$email_link = "<a href='" . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id']) . "'>" . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id']) . "</a>";
$server_link = "<a href='" . HTTP_SERVER . DIR_WS_CATALOG . "'>" . HTTP_SERVER . DIR_WS_CATALOG . "</a>";
$email_body .= sprintf(TEXT_EMAIL_LINK, $email_link ) . "\n\n" .
sprintf(TEXT_EMAIL_SIGNATURE, STORE_NAME . "\n" . $server_link . "\n");
tep_mail($HTTP_POST_VARS['friendname'], $HTTP_POST_VARS['friendemail'], $email_subject, nl2br(stripslashes($email_body)), '', $from_email_address);
Note: The proper fix for nl2br it's not as here. All emails should contain both <br/> and \n and be sent with tep_email(). If HTML email is disabled, <br/> will be removed by strip_tags()