Mail form- HELP!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

eblumrich
Forum Newbie
Posts: 11
Joined: Wed Nov 24, 2004 1:29 pm

Mail form- HELP!

Post by eblumrich »

Quick to the chase:

I am developing a website for a client, and he wants a mail form where folks can "send this page to a friend". I have that part up and running, but here's the rub:

The clinet wants each message CCd to his e-mail address. I have NO idea of how to do this.

The page is here:

http://www.governorgirlieman.com/mail.html

and the PHP script is here:

http://www.governorgirlieman.com/sendurl.php

(just go to those pages, and "view source")

Can anyone here PLEASE help me out, on this?

I have spent six hours looking all over the web, and other forums, for such information, but none of it is of any use. I'm new to PHP, and it's incomprehensible to me.

Thanks much, for any help you can provide.
PanK
Forum Commoner
Posts: 36
Joined: Mon Nov 22, 2004 1:24 pm
Location: Richmond Hill, ON, Canada

Post by PanK »

Here is example from php_manual

Code: Select all

<?php
/* recipients */
$to  = "mary@example.com" . ", " ; // note the comma
$to .= "kelly@example.com";

/* subject */
$subject = "Birthday Reminders for August";

/* message */
$message = '
<html>
<head>
<title>Birthday Reminders for August</title>
</head>
<body>
<p>Here are the birthdays upcoming in August!</p>
<table>
<tr>
  <th>Person</th><th>Day</th><th>Month</th><th>Year</th>
</tr>
<tr>
  <td>Joe</td><td>3rd</td><td>August</td><td>1970</td>
</tr>
<tr>
  <td>Sally</td><td>17th</td><td>August</td><td>1973</td>
</tr>
</table>
</body>
</html>
';

/* To send HTML mail, you can set the Content-type header. */
$headers  = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";

/* additional headers */
$headers .= "To: Mary <mary@example.com>, Kelly <kelly@example.com>\r\n";
$headers .= "From: Birthday Reminder <birthday@example.com>\r\n";
$headers .= "Cc: birthdayarchive@example.com\r\n";
/*
$headers .= "Cc: ".$ccemailaddress."\r\n";
*/
$headers .= "Bcc: birthdaycheck@example.com\r\n";

/* and now mail it */
mail($to, $subject, $message, $headers);
?>
Last edited by PanK on Wed Nov 24, 2004 1:59 pm, edited 1 time in total.
eblumrich
Forum Newbie
Posts: 11
Joined: Wed Nov 24, 2004 1:29 pm

Doesn't work- please help, again

Post by eblumrich »

Tried the script- doesn't work. I get the error:

Parse error: parse error, unexpected T_VARIABLE in /home/content/j/o/h/johnredgell/html/mail2.php on line 1

when it is posted.

You can view it at:

http://www.governorgirlieman.com/mail2.php

Again-

I urge you to PLEASE look at the URLs in my previous post:

http://www.governorgirlieman.com/mail.html

and

http://www.governorgirlieman.com/sendurl.php

Is there no way that a simple line of script can be added to the existing code?

thanks.
PanK
Forum Commoner
Posts: 36
Joined: Mon Nov 22, 2004 1:24 pm
Location: Richmond Hill, ON, Canada

Post by PanK »

Parse error - syntax erorr. there was ?> ?> at the end. Did you remove one?
eblumrich
Forum Newbie
Posts: 11
Joined: Wed Nov 24, 2004 1:29 pm

No, I didn't.

Post by eblumrich »

No, I didn't- I used the script you have, above, word-for-word, character-for-character.

There's gotta be a way to do this.

I appreciate your help- this is driving me insane- I've spent a cumulative 20 hours, trying to figure this out, and like I said, PHP is about as supple and flexible as a three-foot-thick railroad tie.
PanK
Forum Commoner
Posts: 36
Joined: Mon Nov 22, 2004 1:24 pm
Location: Richmond Hill, ON, Canada

Post by PanK »

Show your code.
eblumrich
Forum Newbie
Posts: 11
Joined: Wed Nov 24, 2004 1:29 pm

code cut and pasted from previous discussion

Post by eblumrich »

<?php
/* recipients */
$to = "mary@example.com" . ", " ; // note the comma
$to .= "kelly@example.com";
/* subject */
$subject = "Birthday Reminders for August";
/* message */
$message = '
<html>
<head>
<title>Birthday Reminders for August</title>
</head>
<body>
<p>Here are the birthdays upcoming in August!</p>
<table>
<tr> <th>Person</th><th>Day</th><th>Month</th><th>Year</th>
</tr>
<tr> <td>Joe</td><td>3rd</td><td>August</td><td>1970</td>
</tr>
<tr> <td>Sally</td><td>17th</td><td>August</td><td>1973</td>
</tr>
</table>
</body>
</html>
';
/* To send HTML mail, you can set the Content-type header. */
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
/* additional headers */
$headers .= "To: Mary <mary@example.com>, Kelly <kelly@example.com>\r\n";
$headers .= "From: Birthday Reminder <birthday@example.com>\r\n";
$headers .= "Cc: birthdayarchive@example.com\r\n";
$headers .= "Bcc: birthdaycheck@example.com\r\n";
/* and now mail it */
mail($to, $subject, $message, $headers);
?>
?>
PanK
Forum Commoner
Posts: 36
Joined: Mon Nov 22, 2004 1:24 pm
Location: Richmond Hill, ON, Canada

Post by PanK »

That's the code I gave you. What do you have right now in your page?
rehfeld
Forum Regular
Posts: 741
Joined: Mon Oct 18, 2004 8:14 pm

Post by rehfeld »

there is no parse error in that code you posted.


are you sure you are posting the ENTIRE file? dont leave anything out. post it all.

and please use

Code: Select all

tags when posting so it is formatted
eblumrich
Forum Newbie
Posts: 11
Joined: Wed Nov 24, 2004 1:29 pm

That's the code I have on the page.

Post by eblumrich »

I cut and pasted that code into notepad, and saved it as a PHP document, and uploaded it.

It can be viewed, again, at:

http://www.governorgirlieman.com/mail2.php

-any suggestions?
eblumrich
Forum Newbie
Posts: 11
Joined: Wed Nov 24, 2004 1:29 pm

Doesn't ANYONE here have a solution?

Post by eblumrich »

Other than someone sending me scripts that don't work? Please read first post for details.

-thanks!
PanK
Forum Commoner
Posts: 36
Joined: Mon Nov 22, 2004 1:24 pm
Location: Richmond Hill, ON, Canada

Post by PanK »

Do you know anything about PHP?
rehfeld
Forum Regular
Posts: 741
Joined: Mon Oct 18, 2004 8:14 pm

Post by rehfeld »

the code he posted WORKS

for one, i tried it.
two- its right from the php manual. thus i tend to think it is your error.
eblumrich
Forum Newbie
Posts: 11
Joined: Wed Nov 24, 2004 1:29 pm

Nice question

Post by eblumrich »

A tiny bit- I've spent about 20 hours messing about with it, the past three days, and it makes absolutely no sense to me.

That's why I came here- I just needed a bit of guidance.

I appreciate you givig me some script- but I have no idea of what to do with it- as I said, PHP is about as flexible as a three-foot-wide railroad tie, and I only have a rudimentary understanding.

That's why I posted the PHP and HTML pages I have currently constructed. I was hoping someone could point out to me something VERY simple: How to add a CC command into the existing script.

If you want me to admit I'm clueless- well- here you go:

I'M CLUELESS- I'M A MORON WHO KNOWS NADA ABOUT PHP! If you want, I can hop on one foot naked in the public square, while yelling the previous.

Now, can you give me a tad of help, here? I thought that's what this forum was for.

-thanks.

-eric
eblumrich
Forum Newbie
Posts: 11
Joined: Wed Nov 24, 2004 1:29 pm

Well, it doesn't work, here.

Post by eblumrich »

In fact, if you go to the page where it's posted, now, and "view source", you get a blank.
Post Reply