0% found this document useful (0 votes)
71 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
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
71 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
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
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: [email protected]";

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


echo "Mail sent successfully!";

} else {


echo "Mail not sent!";

?>

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

You might also like