Truemag

  • Categories
    • Tips And Tricks
    • Internet
    • PHP
    • Javascript
    • CSharp
    • SQL Server
    • Linux
  • Lastest Videos
  • Our Demos
  • About
  • Contact
  • Home
  • Write With Us
  • Job Request
Home PHP Simple PHP Code Send Email

Simple PHP Code Send Email

I’ve just order a Cloud and is setting my virtual server on that cloud. After installed LAMP (Apache, MySQL and PHP) on CentOS server, I continue to check whether the PHP mail() function is working.

Below is the content of the test email PHP file. It’s just for testing purpose so the recipient is hard code without any email format validation.

Note: please replace the “[email protected]” on line 2 with your real email address.

<?php
	$to = "[email protected]";
	$subject = "Hello, it is a test email";
	$body = "Congratulation! The PHP Mail function is working";
	if (mail($to, $subject, $body)) 
	{
		echo("<p>Message is sent successful!</p>");
	} 
	else 
	{
		cho("<p>Message delivery failed...</p>");
	}
?>

<?php $to = "[email protected]"; $subject = "Hello, it is a test email"; $body = "Congratulation! The PHP Mail function is working"; if (mail($to, $subject, $body)) { echo("<p>Message is sent successful!</p>"); } else { cho("<p>Message delivery failed...</p>"); } ?>

Jun 28, 2011Hoan Huynh
Delete WordPress Revision Posts, Its Relationships And Meta DataWordPress Delete Unused Post Tags By SQL Command
You Might Also Like:
  • How To Track Website With Multiple Google Analytisc Accounts
  • Facebook Like Button And Recommend Button With fb:like, iframe and html5
  • Send Email Via Gmail SMTP Authentication With PHPMailer
  • PHPMailer Send Email With Attachments Via SMTP Authentication
  • Validate Email Address Format Using PHP Regular Expression preg_match
  • PHPMailer Send Email HTML Content With UTF-8 Encoding
  • PHP Send Email To Multiple Recipients And CC To Multiple Recipients With PHP Mailer
  • CSharp Validate Email Address Function With Regular Expression
  • Google Map Supported Type And Simple Example
  • Jquery checkbox checked
Hoan Huynh

Hoan Huynh is the founder and head of 4rapiddev.com. Reach him at [email protected]

9 years ago PHPCentOS, email address, mail208
0
GooglePlus
0
Facebook
0
Twitter
0
Digg
0
Delicious
0
Stumbleupon
0
Linkedin
0
Pinterest
Most Viewed
PHP Download Image Or File From URL
21,932 views
Notepad Plus Plus Compare Plugin
How To Install Compare Text Plugin In Notepad Plus Plus
19,767 views
Microsoft SQL Server 2008 Attach Remove Log
Delete, Shrink, Eliminate Transaction Log .LDF File
15,600 views
JQuery Allow only numeric characters or only alphabet characters in textbox
13,118 views
C# Read Json From URL And Parse/Deserialize Json
9,570 views
4 Rapid Development is a central page that is targeted at newbie and professional programmers, database administrators, system admin, web masters and bloggers.
Recent Posts
  • Essay Writing Service Tips For The Online Essay
  • Research Paper Writing Service
  • Annotated Bibliography Example – How it Can Help You
  • Essay Writing Online Tips – How to Write Essays Online With Essay Proof Editing
  • Get Research Paper Assistance From Professional Help
Categories
  • CSharp (45)
  • Facebook Graph API (19)
  • Google API (7)
  • Internet (87)
  • iPhone XCode (8)
  • Javascript (35)
  • Linux (28)
  • MySQL (16)
  • PHP (84)
  • Problem Issue Error (29)
  • Resources (32)
  • SQL Server (25)
  • Timeline (5)
  • Tips And Tricks (141)
  • Uncategorized (64)
Recommended
  • Custom Software Development Company
  • Online Useful Tools
  • Premium Themes
  • VPS
2014 © 4 Rapid Development