Story Time Generator and SendMail

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

Post Reply
jon31
Forum Newbie
Posts: 3
Joined: Sat Mar 01, 2003 1:49 pm

Story Time Generator and SendMail

Post by jon31 »

I'm sure you've all seen something like this before, but I'm just learning PHP, and I decided to do it for fun, and to help me learn.

http://storytime.mine.nu

It's a simple story generator, that uses the words you fill in to create some stories. But what I want to do now is allow users to e-mail those stories to their friends. I've gone thru my PHP book "Visual Quickstart Guide to PHP for the WWW" and copied the code exactly, but it doesn't work. I've been told that it's probably due to an incorrect install or bad permissions of sendmail on my apache, which I am running on 10.2.4.

Also, how can I take the text from the story that is created (ie. the entire story, including title and author), and make it one large string, so that I can make that string the Body of the message that is to be sent.

If someone could help, that would be great. I'm sure this doesn't even make much sense.

By the way, the code to send the e-mail is only on the second story, so select it if you want to see it.

Thanks
Jon
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

Could you post the code that is supposed to send emails (what you have that you've programmed so far)?

P.S.: Nice idea btw. :)
User avatar
Jade
Forum Regular
Posts: 908
Joined: Sun Dec 29, 2002 5:40 pm
Location: VA

Post by Jade »

When you actually get your e-mail script working (can't help ya there) then it'd be easy to send the story in the mail. I run an internet game for members and my members need to be able to get their passwords and logins, etc. All you'd have to do would be post the story (exactly as you have on the page after they submit the story) right into the e-mail script and it should send it. This is what I use for my members, hope it helps:

$subject = "Title of your site";

$message = "print the story here again. You can include $vars.";

mail($email, $subject, $message, $extra)
or die("Could not send your e0mail. Contact site administor.");

echo "Mail successfully sent! It should arrive any minute.";

See if this works.
Post Reply