Transcript slides

Web Programming
Week 9
Old Dominion University
Department of Computer Science
CS 418/518 Fall 2010
Martin Klein <[email protected]>
10/26/10
Sending E-Mail
PHP syntax:
mail($to, $subject, $message, $headers);
e.g.
<?php
mail("[email protected]", "My status line",
"If I could only think of a msg I would put it here...");
echo "congrats, your email was sent";
?>
(see firstmail.php, ch10)
Sending E-Mail
$to = "[email protected]";
$subject = "My subject line";
$message = "<h1>If I could only</h1>";
$message .= "<b>think</b>";
$message .= "<i> of a msg</i>";
$message .= "<pre> I would put it here.</pre>";
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "Content-Transfer-Encoding: 7bit\r\n";
mail($to, $subject, $message, $headers);
(see secondmail.php, ch10)
From [email protected] Mon Aug 16 09:33:57 2010
Return-Path: <[email protected]>
Received: from mail.cs.odu.edu (darkisland.csnet.cs.odu.edu [128.82.4.212]) by unixmail.cs.odu.edu (8.14.2/8.14.2) with
ESMTP id o7GDXuSY015967 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NOT)for
[email protected]>; Mon, 16 Aug 2010 09:33:57 -0400 (EDT)
…
MIME-Version: 1.0
…
Subject: Email was hacked, I apologize it is fixed now.
From: john doe <[email protected]>
To: Martin Klein <[email protected]>
Content-Type: multipart/alternative; boundary="001485f626f00069b6048df0e27f“
…
--001485f626f00069b6048df0e27f
Content-Type: text/plain; charset="ISO-8859-1"
In case a message with a link was sent from me my email was corrupted and sent out to my inbox. I have fixed the account
and apologize for the inconvenience.
John
-John M. Doe
--001485f626f00069b6048df0e27f
Content-Type: text/html; charset="ISO-8859-1"
Content-Transfer-Encoding: quoted-printable
Trailing -- indicate end of msg!
<div>In case a message with a link was sent from me my email was corrupted and sent out to my inbox. I have fixed the
account and apologize for the in convenience.</div>
<div>=A0</div>
<div>John<br clear=3D"all"><br>-- <br>John M. Doe<br></div>
--001485f626f00069b6048df0e27f--