PDA

View Full Version : Supplying text for the body of an e-mail


TCrusaderT
09-26-2002, 11:28 PM
Greetings everyone,

Ok, I am trying to popup an e-mail and fill it out with pre-scripted information. I have even found out ways of including the address, subject, and text in the body.

The problem is the text in the body. It is one long drawn-out line that has no end.

My problem - I need to space out paragraphs.

*for example:

(what I GET in the e-mail body)-------
this is one linethis is another line


(what I WANT in the e-mail body)-------
this is one line

this is another line


**
The code that I use is below. The JS creates a button that pops up a mail window. How do you make paragraph/line breaks in the body of that e-mail? OR How do you tell the script to place <DIV></DIV> tags in the email code in the body section of the email?


(credit Happy Smart)
<body bgcolor="#FFFFFF" text="#000000">

<div align="center">
<script language="JavaScript" >
function EmailLink(){
window.location = "mailto:annonymous@nobody.com"
+"?subject=How do I separate these lines?"
+ "&body= this is one line" + "this is another line ";


}
document.write('<INPUT class="select" TYPE="button" VALUE="Try to separate these lines!" onClick="EmailLink()"></FORM>')

</script>
</div>
</body>

beetle
09-27-2002, 01:25 AM
Not sure if you can do this with JS, becuase you can't set any of the headers (like the MIME) and all the data sent to the email agent from the mailto link is a string so <br> and \n don't work...

I think you'll need something server-side for this...

Owl
09-27-2002, 01:48 AM
TT,

The answer already waiting for you where you first asked it.

http://www.webxpertz.net/forums/showthread.php3?threadid=19333

( •) (• )
>>V

TCrusaderT
09-27-2002, 02:13 AM
Oh no . . . It still didn't work.

I have no idea why, is there a browser issue? Does it matter if I'm using Outlook Express?

Is there a function that will place <DIV> tags in the e-mail source?

TCrusaderT
09-27-2002, 02:19 AM
Hi beetle,

I don't know how to make a server-side email. But it sounds like I would have more flexibility over the e-mail content if I do.

Can you give me pointers on how to do this?
You would make one human on this earth very happy :D

Thanks

glenngv
09-27-2002, 02:29 AM
try this:

function EmailLink(){
newline = "%0D%0A";
window.location = "mailto:annonymous@nobody.com"
+"?subject=How do I separate these lines?"
+ "&body= this is line1" +newline+ "this is line2" + newline + "this is line3";
}

beetle
09-27-2002, 02:34 AM
Ah yes, Owl. Seeing your post on that other forum reminded me of the answer, and of this cool tool (http://www.webreference.com/js/column70/3.html)

I should have known better. A mailto: is an href, so it needs to be URLencoded. Tsk tsk :rolleyes:

TCrusaderT, do you have PHP installed on your server? You can test is by creating a file, name it 'info.php' and in it, type this an only this<?php
phpinfo();
?> If PHP is installed, you will see a whole bunch of information about your installation by viewing this file. If not, then you'll probably get a server error or something.

TCrusaderT
09-27-2002, 05:19 PM
Hi Owl, glenngv, and beetle

Now that is interesting. Why doesn't it work for me?
I really do appreciate all your help . . . I wonder if it's because of IE (you use netscape right?)

I put both Owl's code and glenn's code at these locations respectively

http://www.pacepower.com/_test_email1.htm

http://www.pacepower.com/_test_email1-2.htm

View the source, it should be exactly the way you showed me. :confused:

If it works for you, all I can think of is a browser issue (but I'm new at this and I think it should be possible - optimisim or ignorance?)

As for beetle's question of PHP, uh, what do I know? Do you mean create an HTML file with your code?:

<?php
phpinfo();
?>

What's a PHP? And why does that help me?
Thank you everyone for your help

beetle
09-27-2002, 05:46 PM
Originally posted by TCrusaderT
As for beetle's question of PHP, uh, what do I know? Do you mean create an HTML file with your code?No, I mean create a PHP file with that code (name it info.php or index.php or file.php or whatever floats yer boat)Originally posted by TCrusaderT
What's a PHP? And why does that help me?PHP is an open source server-side scripting language. It has the capability to add headers to email messages and whatnot. By creating and uploading that file to your server will let you discover whether or not the server has PHP installed

TCrusaderT
09-27-2002, 11:19 PM
Hi beetle . . . I'm honestly trying here.

I created a php file and the source was ONLY what you told me to put in.

View the file here http://www.pacepower.com/infophp.php

I just get a web page that shows your code in the window. Is that what's supposed to happen?

Eager to hear good news :thumbsup:

beetle
09-27-2002, 11:56 PM
That means you don't have php installed. SO, you need to:

- Contact your webhost and see if they will install it (like it said, it's free, start at www.php.net)

Or, do it w/o PHP :D

whammy
09-28-2002, 01:20 AM
Yeah - unfortunately, mailto: stuff just doesn't work in all email clients. The only way to get a reliable email message sent is to use the server-side scripting language of your choice.

TCrusaderT
09-28-2002, 02:55 AM
Okhay! Whammy . . . sounds good, er, I think.

The only problem is the only thing I know how to code is HTML. Is it easy to create the effect that I'm looking for?

How would I implement something like this?

Is there code available on the net somewhere that you can point me to?

Can you do it for me? (he he . . . er . . . do I get a yes? :o )

All of you have been a realy big help, and I appreciate all the time that you put into my post. So now that it looks like this feature has to be server-side, I'm kinda outa my legue. A few pointers would go a long way. :D

TCrusaderT
09-28-2002, 03:15 AM
Oh no!

And I forgot! Now that things have to be server-side, how can the person edit the e-mail to be sent???? Or how can the person include additional information in the e-mail?

Isn't coding fun?:rolleyes:

ASAAKI
09-28-2002, 10:43 AM
to get started with php try http://www.firepages.com.au/ . go to Downloads>phpdev bundles>phpdev4. i think it's really good, i personally knew next to nothing about all this server side stuff before i used it. the package gives u everything u need: mysql (that's a database), apache (the thing that ur computer needs to work like a server, so that it can execute a server-side scripting language), and php itself(the server side scripting language), plus faqs and info on how to get started. u could download the manuals for more.
i'm sure all the email editing and other stuff can be done with php.

and yes! coding IS fun!! :p

whammy
09-28-2002, 05:36 PM
While you're learning server-side scripting, if you want the email to be sent to you, I have an easy to use formmail script (in my signature below) with example forms... that doesn't require anything but HTML (and that you sign up for my website, so my script knows where to send the emails!).

beetle
09-28-2002, 05:52 PM
I have a PHP formmail too, if you are going to be installing PHP

TCrusaderT
09-30-2002, 05:55 AM
Wow, thank you all for the help.

Alas, I have no idea what you guys are talking about. So I'll have to do some fishing around.

I thought everything was easy to implement, like JS, but it just doesn't seem that way. I have to delve into mysql, apachee, and PHP . . . kinda seems overbearing.

and this is just for an e-mail body. *sigh*

I'll try to sort out this whole mess . . . I thought I could learn from someone who did this before. I don't think that I'm the only one who needs paragraphs in their e-mails. There is no cut an paste solution, or even something set up for that is there?

I guess what would help me now is if someone could post a step by step solution for me and I would follow it as best I can.

That's all I can think of now.
I'm still hopeful though, and hope to learn more from you guys.

TCrusaderT
10-01-2002, 02:34 AM
Ok, I am switching servers to one that supports PHP.

Where do I go from here? I am eager and ready:thumbsup: