/    Sign up×
Community /Pin to ProfileBookmark

Create Template email

Hello ,

I would like to ask how I can create an email template when the user send an email from a website.
I have developed a website where the users can buy online products and also they can send specific items to their friends using the email function. What I would like to do is the email that the customer will receive to have a specific template for example the company’s logo.
I am building the website using php and database MySQL.

I would appreciate if you could suggest a way I can do it.

Thank you,
Xenia

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@XeroSiSJun 29.2006 — check this out! it is inside the php manual:
[code=php]<?php
// multiple recipients
$to = '[email protected]' . ', '; // note the comma
$to .= '[email protected]';

// subject
$subject = 'Birthday Reminders for August';

// message
$message = '
<html>
<head>
<title>Birthday Reminders for August</title>
</head>
<body>
<p>Here are the birthdays upcoming in August!</p>
<table>
<tr>
<th>Person</th><th>Day</th><th>Month</th><th>Year</th>
</tr>
<tr>
<td>Joe</td><td>3rd</td><td>August</td><td>1970</td>
</tr>
<tr>
<td>Sally</td><td>17th</td><td>August</td><td>1973</td>
</tr>
</table>
</body>
</html>
';

// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "rn";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "rn";

// Additional headers
$headers .= 'To: Mary <[email protected]>, Kelly <[email protected]>' . "rn";
$headers .= 'From: Birthday Reminder <[email protected]>' . "rn";
$headers .= 'Cc: [email protected]' . "rn";
$headers .= 'Bcc: [email protected]' . "rn";

// Mail it
mail($to, $subject, $message, $headers);
?>[/code]


just remember if you have any pictures the links must not be for example images/logo.jpg it must be http://www.yoursite.com/images/logo.jpg

inside the $message you can write any html you like!
Copy linkTweet thisAlerts:
@xeniaauthorJun 29.2006 — XeroSiS thank you for your code.

The problem I get is that it displays the html code instead of the table.

I tryied to send an email and the email displayed like this:

[code=html]<html>
<head>
<title>Birthday Reminders for August</title> </head> <body> <p>Here are the birthdays upcoming in August!</p> <table>
<tr>
<th>Person</th><th>Day</th><th>Month</th><th>Year</th>
</tr>
<tr>
<td>This is the message cxv sent. </td><td>3rd</td><td>August</td><td>1970</td>
</tr>
<tr>
<td>Sally</td><td>17th</td><td>August</td><td>1973</td>
</tr>
</table>
</body>
</html>
[/code]
×

Success!

Help @xenia 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 6.18,
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: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

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