Reputation: 32946
so I have a link like this:
mailto:[email protected]?subject=Hello%20You&body=Some%20Body%20Text
and I'd like it to open an email which has an image (ideally) embedded in the mail, or attached to the mail. Ideally I'd also like to add a Table from Excel to the mail as well.
mailto:[email protected]?subject=Hello%20You&body=Some%20Body%20Text%0A<a%20href="image.jpg"/>
Is this possible or am I living in dream land?
Upvotes: 2
Views: 686
Reputation: 17024
Short Answer
No.
Long Answer
It is not possible to send a Image (as HTML), according to the specification RFC2368
The special hname "body" indicates that the associated hvalue is the body of the message. The "body" hname should contain the content for the first text/plain body part of the message. The mailto URL is primarily intended for generation of short text messages that are actually the content of automatic processing (such as "subscribe" messages for mailing lists), not general MIME bodies.
http://www.ietf.org/rfc/rfc2368.txt
So what i should do?
Your best bet would be, to have a server side formular.
<form action="/pathto/serverside/mailer" method="post">
<input type="text" name="name" placeholder="Your name" />
<input type="text" name="mail" placeholder="Your email-adress" />
<input type="text" name="message" placeholder="Your message" />
<input type="submit" value="Send">
</form>
PHP Way
$mail = new PHPMailer;
$mail->IsSMTP();
$mail->Host = $host;
$mail->SMTPAuth = true;
$mail->Username = $username;
$mail->Password = $password;
$mail->From = $from;
$mail->FromName = $fromName;
$mail->AddAddress($to , $toName);
$mail->Subject = $subject;
$mail->Body = $body; //Your Html
$mail->IsHTML(true);
This is based on the PHPMailer Library https://github.com/PHPMailer/PHPMailer, because the built in mail()
function is the devil in person ;)
ASP Way
MailMessage mail = new MailMessage(from, to, subject, message);
mail.IsBodyHtml = true;
SmtpClient client = new SmtpClient("localhost");
client.Send(mail);
Upvotes: 1