Go Back   Cloud Computing > Support > PHP Forum
 

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 10-02-08, 19:57
BOD Member
 
Join Date: Oct 2008
Posts: 30
Default Simple php form to send an email by using mail function.

To send an email by using mail() use the following code in any .php test file for example create a file test.php and use the following code in test.php file
PHP Code:
$to      'test@yahoo.com';
$subject 'The test for mail function';
$message 'Hello';
$headers 'From: test@testforever.com' "\r\n" .
    
'Reply-To: test@testforever.com' "\r\n" .
    
'X-Mailer: PHP/' phpversion();
mail($to$subject$message$headers);
?> 
The above code will send an email after browsing http://yourdomain.com/test.php at test@yahoo.com from test@testforever.com with the content "Hello" and subject "The test for mail function".
__________________
Regards
George
Reply With Quote
  #2 (permalink)  
Old 01-23-09, 17:05
BOD Member
 
Join Date: Jan 2009
Posts: 49
Default

Simple and to the point. That is the way that all code should be. Some folks try to make there code look all complicated and usually all they do is foul it up by trying. Good snippet, thanks for sharing!
Reply With Quote
  #3 (permalink)  
Old 01-24-09, 07:50
BodShane's Avatar
Chief Operating Officer
 
Join Date: Dec 2006
Posts: 1,088
Send a message via AIM to BodShane Send a message via MSN to BodShane
Default

Thanks George

Regards,

Shane Phillips
__________________
Redundant Dedicated Server Hosting Solutions Only at BODHost
24x7 Toll-Free ph. : +1. 866-662-0909
Email : sales@bodhost.com | MSN : sales@bodhost.com
Reply With Quote
  #4 (permalink)  
Old 02-05-09, 16:35
BOD Member
 
Join Date: Jan 2009
Posts: 51
Default

Thanks for the code snippet, but do you have a form script or code that you can share that would be used with this? I think that would make it a complete work and usable by all here.
Reply With Quote
  #5 (permalink)  
Old 03-08-09, 06:59
BOD Member
 
Join Date: Jan 2009
Posts: 73
Default

I have a question - can you send attachments this way ? I have a script on this firum that uses mutt to send a mysql backup to a gmail account -
here (cron job to send a database backup to gmail account) - It would be nice if there were another way as not everyone has mutt on their system

cheers.
Reply With Quote
  #6 (permalink)  
Old 03-30-09, 17:11
BOD Member
 
Join Date: Mar 2009
Location: USA
Posts: 2
Send a message via ICQ to KristFry
Default at the start post

Hi guys! basic every so often paleing & I like to touch this community !
__________________
Krist Fry
Reply With Quote
  #7 (permalink)  
Old 03-30-09, 23:44
BOD Member
 
Join Date: Feb 2008
Posts: 69
Default

Hello Krist,

to bodhost forum.
Reply With Quote
  #8 (permalink)  
Old 04-02-09, 13:26
BOD Member
 
Join Date: Mar 2009
Location: USA
Posts: 2
Send a message via ICQ to KristFry
Default key post

Hey everybody ! This is my 1st job and I'm chuffed I set up this forum !
__________________
Krist Fry
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump


All times are GMT -6. The time now is 01:01.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
Copyright © 1999-2012, BODHost Ltd. All rights reserved.