0% found this document useful (0 votes)
44 views2 pages

Sending Email With PHP

This PHP code defines variables for email address, subject, message body, and headers. It then uses the mail() function to send an email with those parameters. If the mail is sent successfully, it echoes a success message. Otherwise, it echoes a failure message.

Uploaded by

MirunaCatiche
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
44 views2 pages

Sending Email With PHP

This PHP code defines variables for email address, subject, message body, and headers. It then uses the mail() function to send an email with those parameters. If the mail is sent successfully, it echoes a success message. Otherwise, it echoes a failure message.

Uploaded by

MirunaCatiche
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 2

Sending Email: sendingemail.

php
!

<!doctype html>
<html>
<head>
<title>My First Webpage</title>

!
<meta charset="utf-8" />
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />

!
</head>

!
<body>
<div>

!
<?php


$emailTo="";
$subject="I hope this works!";
$body="I think you're great";
$headers="From: rob@robpercival.co.uk";

if (mail($emailTo, $subject, $body, $headers)) {


echo "Mail sent successfully!";

} else {


echo "Mail not sent!";

?>

!
</div>
</body>
</html>

You might also like