Send email html5 download
Here is an example of how you can send an HTML5 email with a download link:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Download Example</title>
</head>
<body>
<h1>Download Example</h1>
<p>Click the link below to download the file:</p>
<a href="https://example.com/file.zip" download="file.zip">Download File</a>
</body>
</html>
This HTML code creates a simple email with a link that, when clicked, will download a file named file.zip
from the specified URL.
To send this email, you can use a mail client or a programming language like PHP to send the email. Here is an example of how you can send the email using PHP:
<?php
$to = '[email protected]';
$subject = 'Download Example';
$message = '<html>
<body>
<h1>Download Example</h1>
<p>Click the link below to download the file:</p>
<a href="https://example.com/file.zip" download="file.zip">Download File</a>
</body>
</html>';
$headers = 'MIME-Version: 1.0'. "\r\n";
$headers.= 'Content-type: text/html; charset=UTF-8'. "\r\n";
mail($to, $subject, $message, $headers);
?>
This PHP code sends an email to the specified recipient with the HTML code as the email body. The download
attribute in the link tag tells the browser to download the file instead of opening it in the browser.
Note that the download
attribute is supported in most modern browsers, but it may not work in older browsers. Additionally, the file must be publicly accessible for the link to work.