email.php

<html>

<head><title>email</title></head>

<body>

<?php

$to = "pgrocer@comcast.net";

$subject = "PHP email";

$body = "PHP is a great language to work with on the web";

$headers = "From: pgrocer@bristol.mass.edu\n";

mail($to,$subject,$body,$headers);

echo "Mail sent to $to";

?>

</body>

</html>

basicemail.php

<?php

$to = "pgrocercomcast.net";

$subject = "Meeting Today!";

$body = "Hello,\n\nI wanted to remind you that we are meeting in K102 at 10AM?";

$headers = "From:pgrocer@bristol.mass.edu";

if (mail($to, $subject, $body, $headers))

   {

    echo("<p>Message sent</p>");

   }

else

   { 

    echo("<p>Message problem</p>");

   }

?>

emailchk.php

<html>

<head><title>email</title></head>

<body>

<?php

$to = "pgrocer@comcast.net";

$subject = "PHP email";

$body = "PHP is a great language to work with on the web";

$headers = "From: pgrocer@bristol.mass.edu\n";

mail($to,$subject,$body,$headers);

echo "Mail sent to $to";

if (@mail($to, $subject, $message))

    {

     echo ("<p>Mail sent to from if $to</p>");

    }

else

    {

     echo ("<p>Problem - mail not sent</p>");

    }

 

?>

</body>

</html>

emailcolor.php

<?php

$to = 'pgrocer@comcast.net' . ',';

$to .= 'p-grocer@rcn.com';

$subject = 'Test HTML in email';

$message = '

<html>

<head>

<title>Testing HTML send in email</title>

</head>

<body bgcolor = "beige">

<p>This is a test</p>

<ul>

<li>Item #1</li>

<li>Item #2</li>

<li>Item #3</li>

</ul>

</body>

</html>

';

$headers = 'MIME-Version: 1.0' . "\r\n";

$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

$headers .= 'To: Test <pgrocer@erols.com>' . "\r\n";

$headers .= 'From: Me <p-grocer@rcn.com>' . "\r\n";

$headers .= 'Cc: Copy<p-grocer@rcn.com>' . "\r\n";

mail($to, $subject, $message, $headers);

echo "Mail sent to $to";

?>

emailcolorcss.php

<?php

$to = 'pgrocer@comcast.net' . ',';

$to .= 'p-grocer@rcn.com';

$subject = 'Test HTML in email';

$message = '

<html>

<head>

<title>Testing HTML send in email</title>

<style type="text/css">

body {

      background-color: beige;

      color: green;

     }

</style>

</head>

<body>

<p>This is a test</font></p>

<ul>

<li>Item #1</li>

<li>Item #2</li>

<li>Item #3</li>

</ul>

</body>

</html>

';

$headers = 'MIME-Version: 1.0' . "\r\n";

$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

$headers .= 'To: Test <pgrocer@erols.com>' . "\r\n";

$headers .= 'From: Me <p-grocer@rcn.com>' . "\r\n";

$headers .= 'Cc: Copy<p-grocer@rcn.com>' . "\r\n";

mail($to, $subject, $message, $headers);

echo "Mail sent to $to";

?>

emailhtml.php

<?php

$to = 'pgrocer@comcast.net' . ',';

$to .= 'p-grocer@rcn.com';

$subject = 'Test HTML in email';

$message = '

<html>

<head>

<title>Testing HTML send in email</title>

</head>

<body>

<p>This is a test</p>

<ul>

<li>Item #1</li>

<li>Item #2</li>

<li>Item #3</li>

</ul>

</body>

</html>

';

$headers = 'MIME-Version: 1.0' . "\r\n";

$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

$headers .= 'To: Test <pgrocer@comcast.net>' . "\r\n";

$headers .= 'From: Me <p-grocer@rcn.com>' . "\r\n";

$headers .= 'Cc: Copy<p-grocer@rcn.com>' . "\r\n";

mail($to, $subject, $message, $headers);

echo "Mail sent to $to";

?>

emailhtml2.php

<?php

$to = "pgrocer@comcast.net" . ",";

$to .= "p-grocer@rcn.com";

$subject = "Test HTML in email";

$message = "

<html>

<head>

<title>Testing HTML send in email</title>

</head>

<body>

<p>This is a test using double quotes</p>

<ul>

<li>Item #1</li>

<li>Item #2</li>

<li>Item #3</li>

</ul>

</body>

</html>

";

$headers = "MIME-Version: 1.0" . "\r\n";

$headers .= "Content-type: text/html; charset=iso-8859-1" . "\r\n";

$headers .= "To: Test <pgrocer@erols.com>" . "\r\n";

$headers .= "From: Me <p-grocer@rcn.com>" . "\r\n";

$headers .= "Cc: Copy<pgrocer@comcast.net>" . "\r\n";

mail($to, $subject, $message, $headers);

echo "Mail sent to $to";

?>

emailhtmlimg.php

<?php

$to = "pgrocerbcc@yahoo.com" . ",";

$to .= "p-grocer@rcn.com";

$subject = "Test email using HTML";

$words = "

<html>

<head>

<title>Testing HTML send in email</title>

</head>

<body>

<p>This is a test of to etc</p>

<ul>

<li>Item #1</li>

<li>Item #2</li>

<li>Item #3</li>

</ul>

</body>

</html>

";

$msgPic= '<img src="http://www.pgrocer.net/Cis44/XHTML/images/CISa.gif">';

$message = $words . $msgPic;

$headers = "MIME-Version: 1.0" . "\r\n";

$headers .= "Content-type: text/html; charset=iso-8859-1" . "\r\n";

$headers .= "To: Test <pgrocer@erols.com>" . "\r\n";

$headers .= "From: Me <p-grocer@rcn.com>" . "\r\n";

$headers .= "Cc: pgrocer@comcast.net" . "\r\n";

mail($to, $subject, $message, $headers);

echo "Mail sent to $to";

?>

emailhtmlimgdata.php

<?php

$stuname = $_REQUEST["stuname"];

$grade = $_REQUEST["grade"];

$to = "pgrocer@comcast.net" . ",";

$to .= "p-grocer@rcn.com";

$subject = "Test HTML in email";

$words = "

<html>

<head>

<title>Testing HTML send in email</title>

</head>

<body>

<p>This is a test using double quotes</p>

<ul>

<li>Item #1</li>

<li>Item #2</li>

<li>Item #3</li>

</ul>

</body>

</html>

";

$msgPic= '<img src="http://www.pgrocer.net/Cis44/XHTML/images/CISa.gif">';

$message = $words . $msgPic;

$message .= "\nStudentName: " . $stuname;

$message .= "\nGrade: " . $grade;

$headers = "MIME-Version: 1.0" . "\r\n";

$headers .= "Content-type: text/html; charset=iso-8859-1" . "\r\n";

$headers .= "To: Test <pgrocer@erols.com>" . "\r\n";

$headers .= "From: Me <p-grocer@rcn.com>" . "\r\n";

$headers .= "Cc: Copy<pgrocer@comcast.net>" . "\r\n";

mail($to, $subject, $message, $headers);

echo "Mail sent to $to";

?>

emailhtmlimgmail.php

<?php

$stuname = $_REQUEST["stuname"];

$grade = $_REQUEST["grade"];

$to = "pgrocer@comcast.net" . ",";

$to .= "pwgrocer@yahoo.com";

$subject = "Test HTML in email";

$words = "

<html>

<head>

<title>Testing HTML send in email</title>

</head>

<body>

<p>This is a test using double quotes</p>

<ul>

<li>Item #1</li>

<li>Item #2</li>

<li>Item #3</li>

</ul>

</body>

</html>

";

$msgPic= '<img src="http://www.pgrocer.net/Cis44/XHTML/images/CISa.gif">';

$clickMsg = '<a href="http://www.pgrocer.net">click here to go to pgrocer.net</a>';

$message = $words . $msgPic . $clickMsg;

$message .= "\nStudentName: " . $stuname;

$message .= "\nGrade: " . $grade;

$headers = "MIME-Version: 1.0" . "\r\n";

$headers .= "Content-type: text/html; charset=iso-8859-1" . "\r\n";

$headers .= "To: Test <pgrocer@erols.com>" . "\r\n";

$headers .= "From: Me <p-grocer@rcn.com>" . "\r\n";

$headers .= "Cc: Copy<pgrocer@comcast.net>" . "\r\n";

mail($to, $subject, $message, $headers);

echo "Mail sent to $to";

?>

testimage.php

<?php

$to = "pgrocer@comcast.net" . ",";

$to .= "p-grocer@rcn.com";

$subject = "Test HTML in email";

$words = "

<html>

<head>

<title>Testing HTML send in email</title>

</head>

<body>

<p>This is a test using double quotes</p>

<ul>

<li>Item #1</li>

<li>Item #2</li>

<li>Item #3</li>

</ul>

<p>This is an image:<br>

<img src='http://www.pgrocer.net/Cis44/XHTML/images/CISa.gif'>

</p>

</body>

</html>

";

$msgPic= '<img src="http://www.pgrocer.net/Cis44/XHTML/images/CISa.gif">';

$message = $words . $msgPic;

$headers = "MIME-Version: 1.0" . "\r\n";

$headers .= "Content-type: text/html; charset=iso-8859-1" . "\r\n";

$headers .= "To: Test <pgrocer@erols.com>" . "\r\n";

$headers .= "From: Me <p-grocer@rcn.com>" . "\r\n";

$headers .= "Cc: Copy<pgrocer@comcast.net>" . "\r\n";

mail($to, $subject, $message, $headers);

echo "Mail sent to $to";

?>

testimage1.php

<?php

$to = "pgrocer@comcast.net" . ",";

$to .= "p-grocer@rcn.com";

$subject = "Test HTML in email";

$words = '

<html>

<head>

<title>Testing HTML send in email</title>

</head>

<body>

<p>This is a test using single quotes</p>

<ul>

<li>Item #1</li>

<li>Item #2</li>

<li>Item #3</li>

</ul>

<p>This is an image:<br>

<img src="http://www.pgrocer.net/Cis44/XHTML/images/CISa.gif">

</p>

</body>

</html>

';

$msgPic= '<img src="http://www.pgrocer.net/Cis44/XHTML/images/CISa.gif">';

$message = $words . $msgPic;

$headers = "MIME-Version: 1.0" . "\r\n";

$headers .= "Content-type: text/html; charset=iso-8859-1" . "\r\n";

$headers .= "To: Test <pgrocer@erols.com>" . "\r\n";

$headers .= "From: Me <p-grocer@rcn.com>" . "\r\n";

$headers .= "Cc: Copy<pgrocer@comcast.net>" . "\r\n";

mail($to, $subject, $message, $headers);

echo "Mail sent to $to";

?>