CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge -> Programming

 insert newline in the mail body

Print topic Send  topic

Author Message
udstx

Posts: 10
Posted: 03/30/2009, 8:27 AM

I used the following code to create a mail link and all works well except for inserting some blank lines in the body.
===================start code================
function items_BeforeShow(& $sender)
{
$items_BeforeShow = true;
$Component = & $sender;
$Container = & CCGetParentContainer($sender);
global $items; //Compatibility
$lnk="mailto:library@trinitybiblechurch.com&subject=ITEM ".CCGetParam('idn','')." REQUEST";
$body="&body=My NAME and PHONE NUMBER are:<br><br>Please notify me when this item is available to check out.";
if ( $items->stat->GetValue() == "in") $body="&body=My NAME and PHONE NUMBER are:\n\nPlease reserve this item for me. I will stop by the library to check it out in the upcoming week.";
$lnk=$lnk.$body;
$items->Link1->SetLink($lnk);
return $items_BeforeShow;
}
===========end code=====================-

Neither the HTML code (<br>) or the special character (\n) code works. I also tried "chr(10)" without success.

In all cases, the text is run together without the inclusion of 2 blank lines.

Would sombody please shine some light on this or point me to some documentation.
View profile  Send private message
melvyn


Posts: 333
Posted: 03/31/2009, 9:00 AM

It's up to the computer you're running it. Carriage returns (A.K.A. "new lines") is treated in different ways by the host OS.

If you're running it in your test machine (windows) it will not work same as your production server (linux). Try running your code in both and see :-)

If you're running on linux or something so, try this: \\r\\n

Windows => \r\n
*nix => \r
Mac => \n
_________________
Melvyn Perez
Puro Codigo
http://purocodigo.com
View profile  Send private message
udstx

Posts: 10
Posted: 03/31/2009, 2:28 PM

Thanks for the reply

I understand the different 'new line' codes based on OS. I have tried various combinations of \n and \r but they get stripped out when passed as the '&body=?????' portion of the mailto: link variable.

I am doing a poor job of describing the problem.

Does anybody have an example of creating a 'mailto:' link that contains a body containing multiple lines of text. The 'MailTo Hyperlink' example in the Tips and Tricks works but does not cover any details.
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright 2003-2004 by UltraApps.com  and YesSoftware, Inc.