Flash Games

 FAQ   Search   Members   Groups   User Control Panel      Login 

It is currently Thu Jan 08, 2009 3:27 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: Send an email from you website
PostPosted: Mon Dec 24, 2007 1:11 pm 
Offline
500+ Club
User avatar

Joined: Thu Jan 25, 2007 2:10 pm
Posts: 640
Location: Midlands, England
This question has been ask so often, so here it is.

Simple mail function, send a flat email.
[php]<?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);
?>[/php]
This wont be very useful to most people, as it is very rarely you want to sent the same email to one person repeatedly.

So next i will show you how to create a form that will be used to send the email. I this example i will use a contact form on a web page that allows visitors to send a message to the owner.

First create a page called contact.php, then enter this code:
Code:
<form method=POST action="send.php">
Email: <input name="email"><br>
Subject: <input name="subject"><br>
Message:<br>
<textarea name="message" cols=40 rows=6></textarea><br>
<input type=submit value="send">
</form>

Then make another page called send.php:
[php]<?php
$to ='nosmo-kings@hotmail.com'; //Your email address (webmasters email address)
$subject = $_POST['subject']; //Gets the subject sent by the form
$message = $_POST['message']; //Gets the message sent by the form
$headers = 'From: ' . $_POST["email"] . "\r\n" .
'Reply-To: ' . $_POST["email"] . "\r\n" .
'X-Mailer: PHP/' . phpversion();
//Changes the reply to email so the webmaster can easily reply
mail($to, $subject, $message, $headers);
//Shows a message when email is sent
echo "message sent";
?>[/php]
Now the contact form should be up and running. Emails may be placed in recipients junk mail box for security reasons.

I hope this answers everyones questions, but if you need any more help don't hesitate to ask,
Flabby Rabbit


Top
 Profile  
 
 Post subject:
PostPosted: Mon Dec 31, 2007 10:02 pm 
Offline

Joined: Mon Dec 10, 2007 4:53 am
Posts: 4
i think I'm too stupid..
may i know what is the good start for me to learn any basic programming language...do i need to download or installed it?can we start with notepad?i make a research that notepad can save to certain program like .vbs, .bat.
is any other?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 01, 2008 11:27 pm 
Offline
1000+ Club

Joined: Thu May 31, 2007 4:28 pm
Posts: 1126
Location: Belfast, Northen Ireland
Yea you can use notepad. Save it as .php the way you save the other stuff in different formats like .html, .vbs and so on.

_________________
Yummy Articles
Image


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 20, 2008 3:53 am 
Offline
50+ Club

Joined: Wed Jun 20, 2007 1:51 am
Posts: 87
Location: Australia
ok. i have tried this out and have not got it working properly. with the 'contact.php' is there any php scripting needed? as i am new to PHP scripting and am not sure what to do with it.

Thanks DD

_________________
I put everything down to this: EWIT (Everything Works In Theory)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 20, 2008 9:42 am 
Offline
Site Admin
User avatar

Joined: Tue Aug 17, 2004 2:07 pm
Posts: 2505
Location: Sweden
The only changes in the PHP-script you'll have to do is to change the e-mail in:
$to ='nosmo-kings@hotmail.com';

_________________
Make sure to check out our TNX Review and Link Vault Review


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 12, 2008 2:50 pm 
Offline
100+ Club
User avatar

Joined: Tue Dec 18, 2007 8:11 am
Posts: 147
Location: Switzerland
If you don't want your emails to be marked as spam when they are received, you may want to have a look at this topic:

how-to-avoid-being-spam-vt9653.html

cheers!
- leonard

_________________
:%s/^M//
There are 10 kinds of people:
Those who understand binary and those who don't.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jun 14, 2008 5:20 am 
Offline
50+ Club

Joined: Wed Jun 20, 2007 1:51 am
Posts: 87
Location: Australia
Ok i have a large form i need this script for. DO i have to input each individual field into the script or will it take all fields into the message and send as is?

DD

_________________
I put everything down to this: EWIT (Everything Works In Theory)


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jun 14, 2008 10:47 am 
Offline
1000+ Club

Joined: Thu May 31, 2007 4:28 pm
Posts: 1126
Location: Belfast, Northen Ireland
You need to put all the individual fields into the script. Well the ones you want to get from your user....

_________________
Yummy Articles
Image


Last edited by Johnathan on Wed Oct 22, 2008 10:29 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Sat Jun 14, 2008 11:59 am 
Offline
50+ Club

Joined: Wed Jun 20, 2007 1:51 am
Posts: 87
Location: Australia
lol ok now i see *points to self* learn to friggen read sip**** lol
thanks john

_________________
I put everything down to this: EWIT (Everything Works In Theory)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group - Flash Games - TNX Invitation Code - TNX Review

Welcome to DEVPPL.com
You are not logged in, which means that you can't post in the forums.
Click here to Register

If you are a current member here on DEVPPL, please login below:

User:
Pass:
Log me on automatically each visit: