It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming PHP and MySQL Forum Script-archive

Send an email from you website

Share your completed scripts.

Moderator: Malcolm

Re: Send an email from you website

Postby dflynn on Tue Dec 29, 2009 5:13 am

niz972 wrote:niz972

Niz, just add your page url between the quotes in: $message = 'enter the message here';

You just need to devise a way to manage your URLs.
Most sites these days use $ _GET variables in the url such as: http://www.mysite.com/index.php?page=19

So for this exampe I would use:
Code: Select all
<?php
if(isset($ _GET['page']{
page = $ _GET['page']
}
//bunch of code..
$message = ' blah blah blah, my message.   Link: http://www.mysite.com/index.php?page='.$page.'';



Here's Flabbyrabbit's original flat-email code cleaned up a bit.
Code: Select all
<?php
$to = 'to@hotmail.com'; //address email should be sent to

$subject = 'subject here'; //Subject of the email

$message = 'enter the message here'; //The message
//These extra headers allow you to set who the message is from

$headers = 'From: webmaster@example.com' . "\r\n" .
                 'Reply-To: webmaster@example.com' . "\r\n" .
                 'X-Mailer: PHP/' . phpversion();
//"From" is address that the email would have been sent from
//"Reply-To" is the address that any replies will be sent to

//This line sends your message
mail($to, $subject, $message, $headers);
?>
User avatar
dflynn
500+ Club
 
Posts: 860
Joined: Wed Oct 03, 2007 9:06 pm
Location: Guelph, Canada

Previous

Who is online

Users browsing this forum: No registered users and 0 guests