It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Partner Sites
Board index Programming HTML Forum

html emails

html emails

Postby joshcxa on Thu Jul 21, 2005 4:28 am

How do I create those html emails.
You know the ones that look like a website in your inbox.
joshcxa
DEVPPL Lightwave Moderator
User avatar
joshcxa
100+ Club
 
Posts: 156
Joined: Wed Aug 18, 2004 11:59 am
Location: Australia

Postby webmaster on Thu Jul 21, 2005 9:16 am

The only thing that makes an email to be shown as HTML is something called header information. when you send the email, you first declare what kind of document you're sending. Here's an example of a HTML e-mail:

[php]<?php
$to = "johndoe@fakedomain.com";
$from = "janedoe@anotherfakedomain.com";
$subject = "This is a test email";
$message = <<<EOF
<html>
<body bgcolor="#ffffff">
<p align="center">
<b>Hello World!</b>
</p>
</body>
</html>
EOF;

$headers = "From: $from\r\n";
$headers .= "Content-type: text/html\r\n";

$success = mail($to, $subject, $message, $headers);
if ($success)
echo "The email to $to from $from was successfully sent";
else
echo "An error occurred when sending the email to $to from $from";
?> [/php]
Make sure to check out our TNX Review and Link Vault Review
User avatar
webmaster
Site Admin
 
Posts: 2589
Joined: Tue Aug 17, 2004 2:07 pm
Location: Sweden

Postby Phate on Thu Jul 21, 2005 4:05 pm

wow, i never knew you could do that!
Web-Developing since '03
Image
User avatar
Phate
500+ Club
 
Posts: 826
Joined: Sun Nov 21, 2004 5:12 am
Location: 127.0.0.1

Postby joshcxa on Fri Jul 22, 2005 3:57 am

so what do i do with that?
joshcxa
DEVPPL Lightwave Moderator
User avatar
joshcxa
100+ Club
 
Posts: 156
Joined: Wed Aug 18, 2004 11:59 am
Location: Australia

Postby webmaster on Fri Jul 22, 2005 9:22 am

joshcxa wrote:so what do i do with that?
I don't know how to do it with plain html, but with php, you could use the first script I posted.

Just change $to, $from and $subject and $message and you can send a html e-mail.
Make sure to check out our TNX Review and Link Vault Review
User avatar
webmaster
Site Admin
 
Posts: 2589
Joined: Tue Aug 17, 2004 2:07 pm
Location: Sweden

Postby joshcxa on Fri Jul 22, 2005 1:55 pm

but what i mean is...do i have that code in a seperate file attachted to the email?
joshcxa
DEVPPL Lightwave Moderator
User avatar
joshcxa
100+ Club
 
Posts: 156
Joined: Wed Aug 18, 2004 11:59 am
Location: Australia

Postby webmaster on Fri Jul 22, 2005 2:02 pm

This code sends the e-mail. If you save this code in a file called mailscript.php, upload it to your server and run www.yourdomain.com/mailscript.php it will send a html-mail to the e-mail address in the top of the script.
Make sure to check out our TNX Review and Link Vault Review
User avatar
webmaster
Site Admin
 
Posts: 2589
Joined: Tue Aug 17, 2004 2:07 pm
Location: Sweden

Postby joshcxa on Mon Jul 25, 2005 3:51 pm

oh ok...but what about for a mailing list type thing?
joshcxa
DEVPPL Lightwave Moderator
User avatar
joshcxa
100+ Club
 
Posts: 156
Joined: Wed Aug 18, 2004 11:59 am
Location: Australia

Postby ReFredzRate on Mon Jul 25, 2005 6:28 pm

joshcxa wrote:oh ok...but what about for a mailing list type thing?

I assume you are talking about a webpage styled e-mail you receive?
ReFredzRate
1000+ Club
 

Postby joshcxa on Tue Jul 26, 2005 6:04 am

yep
joshcxa
DEVPPL Lightwave Moderator
User avatar
joshcxa
100+ Club
 
Posts: 156
Joined: Wed Aug 18, 2004 11:59 am
Location: Australia

Postby joshcxa on Wed Jul 27, 2005 1:18 pm

joshcxa
DEVPPL Lightwave Moderator
User avatar
joshcxa
100+ Club
 
Posts: 156
Joined: Wed Aug 18, 2004 11:59 am
Location: Australia

Postby dafunkymunky on Thu Aug 18, 2005 9:57 am

its not possible to send mails using plain html..you need php or asp for that...
--------DAFUNKYMUNKY--------
::THE::NECESSARY::[D]EVIL::
....errr i mean munky....
User avatar
dafunkymunky
100+ Club
 
Posts: 182
Joined: Fri Apr 08, 2005 8:32 am
Location: India

Postby Phate on Thu Aug 18, 2005 6:45 pm

that tutorial will work... it is telling you to make a .html, and attach it to any email, IN YOUR PREVIOUS email software
Web-Developing since '03
Image
User avatar
Phate
500+ Club
 
Posts: 826
Joined: Sun Nov 21, 2004 5:12 am
Location: 127.0.0.1

Postby joshcxa on Mon Aug 29, 2005 3:25 am

yeah.
well that seems to work alright for me
joshcxa
DEVPPL Lightwave Moderator
User avatar
joshcxa
100+ Club
 
Posts: 156
Joined: Wed Aug 18, 2004 11:59 am
Location: Australia

Postby joshcxa on Fri Sep 02, 2005 3:33 am

Actually I have changed my mind. I like webmasters way of doing it.

I've tried to make a page where you type in the recipients email into a text field instead of having to change the email in the code like your example. But i've failed. (noob) Any ideas please?
joshcxa
DEVPPL Lightwave Moderator
User avatar
joshcxa
100+ Club
 
Posts: 156
Joined: Wed Aug 18, 2004 11:59 am
Location: Australia

Next

Who is online

Users browsing this forum: No registered users and 3 guests