/    Sign up×
Community /Pin to ProfileBookmark

Including image in HTML e-mail

I have modified the code in the ‘sticky’ on uploading images so that I am sent an e-mail when someone does so. I would like to include a copy of the image in that e-mail, but find MIME types and the PHP Manual in that area heavy going. I can put a link to the image in my e-mail message, but want it to be HTML so that I can see the image itself in the message. I can do the coding for any necessary resizing of the image. I am sure the answer is simple once you know how.

to post a comment
PHP

7 Comments(s)

Copy linkTweet thisAlerts:
@hastxSep 24.2007 — If you have the image hosted somewhere on the internet, just include it in your html source as usual

[code=html]
<img src="http://www.domain.com/where_image_is/img.jpg">
[/code]
Copy linkTweet thisAlerts:
@gizmoauthorSep 24.2007 — I've already done that bit, but how do I get the e-mail that is sent to me to accept HTML? In other words, how do I make it an HTML e-mail as opposed to plain text?
Copy linkTweet thisAlerts:
@rulianSep 24.2007 — you cannot control whether the user will accept HTML emails or not,

the most you can do is have an alternate text version of the email available
Copy linkTweet thisAlerts:
@YelgnidrocSep 24.2007 — If I am sending an html e-mail I always send a mime e-mail with plain text as well because not everyone can read html e-mails.
Copy linkTweet thisAlerts:
@gizmoauthorSep 24.2007 — The e-mail to be sent to me as the sole recipient and I wish to receive it in HTML format so that I can include with the text a single image using the <img> tag already discussed.
Copy linkTweet thisAlerts:
@bokehSep 24.2007 — [code=php]function HTMLemail($to, $subject, $content, $headers = null)
{
$headers .= "MIME-Version: 1.0rn";
$headers .= "Content-type: text/html; charset=iso-8859-1rn";

$message = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">'."n".
'<html>'."n".
'<head>'."n".
'<title></title>'."n".
'</head>'."n".
'<body>'."n".
"{$content}n".
'</body>'."n".
'</html>'."n";
return @mail($to, $subject, $message, $headers);
}[/code]
Copy linkTweet thisAlerts:
@gizmoauthorSep 25.2007 — Many thanks, Bokeh, your help is much appreciated..
×

Success!

Help @gizmo spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.5,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...