como enviar e-mails em formato HTML??

Enviada por Diego Design 
Diego Design
como enviar e-mails em formato HTML??
27 de March de 2001 às 11:52PM
eu tenho uma mail list e gostaria de saber como eu envio e-mails em formato HTML, será que poderiam me ajudar?

Valew
Leandro Gregolin
Re: como enviar e-mails em formato HTML??
28 de March de 2001 às 07:22PM
$corpo="Corpo do Mail";
$subject= "Assunto do Mail";

$email_env='E-mail do remetente';
$email_reply='E-mail para o reply';


$headers = "From: ".$email_env."\n";
$headers .= "Reply-to: ".$email_reply."\n";
$headers .= "Content-Type: text/html; charset=us-ascii\n";
$headers .= "X-Mailer: PHP4 Script Language\n";
$headers .= "X-Accept-Language: en\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Transfer-Encoding: 7bit\n";
echo $email;
mail ($email, $subject, $corpo, $headers);
---------------------------

Só enviar agora :-)
Diego Design
Re: como enviar e-mails em formato HTML??
28 de March de 2001 às 11:39PM
hehehe.. há um pequeno probleminha, onde eu insiro isso nesse script abaixo:


"

<?php
// Set the username and password. CaSe SeNsItIvE.
include 'http://www.icquente.com/padrao.inc';
$user = "admin";
$pass = "ddw321";

// The title of the mailing list..

$list_name = "ICQuente News";

// The full server path to the data file.

$list_file = "/usr/local/etc/httpd/sub/icquente/news/list.dat";

// All emails from the list will be sent to this address.

$owner_email = "icquente@icquente.com";

// Send a welcome message on subscription. Yes: 1 No: 0

$send_welcome = "1";

// The subject of the welcome message.

$welcome_subject = "Seja Bem-vindo ao $list_name";

// The the content of the welcome message.

$welcome_msg = "
O e-mail: $email foi adicionado ao $list_name com sucesso.";

// Send a goodbye message on unsubscription. Yes: 1 No: 0

$send_goodbye = "1";

// The subject of the goodbye message.

$goodbye_subject = "Você foi removido do $list_name";

// The the content of the goodbye message.

$goodbye_msg = "
O e-mail: $email foi removido do $list_name.";

// No Need to edit below here.

$version = "1.0";

$msg_footer ="

---
Se você recebeu esse e-mail por engano ou quer se retirar do $list_name:
http://$HTTP_HOST$PHP_SELF?action=unsub&email=$email
";

// If statements to determine the action.

if ($action == "admin") { admin(); }
elseif ($action == "sub") { subscribe(trim($email)); }
elseif ($action == "unsub") { unsubscribe(trim($email)); }
else { print_subscribe_form(); }
;

function admin() {
// Controls the administration options.
global $q, $username, $password, $user, $pass;
if (($user == $username) && ($pass == $password)) {
if ($q == "send_msg") { admin_send_msg(); }
elseif ($q == "send_msg_confirm") { admin_send_msg_confirm(); }
elseif ($q == "write_msg") { admin_write_msg(); }
elseif ($q == "view_subs") { admin_view_subs(); }
elseif ($q == "sub_unsub") { print_subscribe_form(); }
admin_print_options();
}
else {
if (($username == "") && ($password == "")) { admin_print_logon(""); }
else { admin_print_logon("Login ou senha inválidos"); }
}
}

function subscribe($email) {
// Checks for a valid email address and then adds email to data file.
global $list_file, $list_name, $send_welcome;
if (valid_email($email)) {
if (!on_list($email)) {
$emailr = "$email\n";
$fd = @fopen($list_file, "a");
if ($fd) {
fputs($fd, $emailr);
fclose($fd);
if ($send_welcome) { send_confirmation(trim($email)); }
echo "<center><font face=\"verdana,arial,helvetica\"><b>O e-mail: \"$email\" foi adicionado com sucesso ao $list_name.</b>";
if ($send_welcome) { echo "<br>Uma mensagem de boas-vindas está sendo enviado para esse e-mail."; }
echo "</font></center>";
}
else {
echo "<center><font face=\"verdana,arial,helvetica\"><b>A lista não foi aberta</b><br>Cheque o path e as permissões<br>Esses e-mails estão cadastrados?</font></center>";
}
}
else {
echo "<center><font face=\"verdana,arial,helvetica\"><b>O e-mail: \"$email\" já está cadastrado</b></font></center>";
}
}
else {
echo "<center><font face=\"verdana,arial,helvetica\"><b>O e-mail: \"$email\" não é válido.</b></font></center>";
}
}

function unsubscribe($email) {
// Removes email from list if it exists.
global $list_file, $list_name, $send_goodbye;
$file = @file($list_file);
if ($file) {
foreach($file as $address) {
$address = trim($address);
if ($address != $email) {
$address_array[] = $address;
}
}
if (count($address_array) != count($file)) {
$fd = @fopen($list_file, "w");
if ($fd) {
if (count($address_array) > 0) {
foreach($address_array as $address) {
fputs($fd, "$address\n");
}
}
}
fclose($fd);
echo "<center><font face=\"verdana,arial,helvetica\"><b>O e-mail: \"$email\" foi removido com sucesso do $list_name.</b></font></center>";
if ($send_goodbye) { send_goodbye($email); }
}
else {
echo "<center><font face=\"verdana,arial,helvetica\"><b>Não foi possível remover este e-mail \"$email\"</b><br>Ele não está inscrito no $list_name.</font></center>";
}
}
else {
echo "<center><font face=\"verdana,arial,helvetica\"><b>Não foi possível remover o e-mail: \"$email\"</b><br>O $list_name está vazio.</font></center>";
}
}
function valid_email($email) {
// Checks for valid email address and hostname.
if (eregi("^[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-z]{2,3}$", $email, $check)) {
if ( getmxrr(substr(strstr($check[0], '@'), 1), $validate_email_temp) ) {
return TRUE;
}
if(checkdnsrr(substr(strstr($check[0], '@'), 1),"ANY")){
return TRUE;
}
}
return FALSE;
}

function on_list($email) {
// Returns true if email address is on list.
global $list_file;
$found = false;
$file = @file($list_file);
if ($file) {
foreach ($file as $address) {
if (trim($address) == trim($email)) {
$found = true;
}
}
}
return $found;
}

function send_confirmation($email) {
// Send confirmation letter to new subscriber.
global $welcome_msg, $welcome_subject, $list_name, $owner_email, $msg_footer;
$headers = "From: \"$list_name\" <$owner_email>\nReply-To: $owner_email\nX-Mailer: PHPMailList http://php.warpedweb.net/";
$welcome_msg .= $msg_footer;
mail($email, $welcome_subject, $welcome_msg, $headers);
}

function send_goodbye($email) {
// Send goobbye message to unsubscriber.
global $goodbye_msg, $goodbye_subject, $list_name, $owner_email;
$headers = "From: \"$list_name\" <$owner_email>\nReply-To: $owner_email\nX-Mailer: PHPMailList http://php.warpedweb.net/";
mail($email, $goodbye_subject, $goodbye_msg, $headers);
}

function admin_write_msg() {
// Prints the form to send a message.
global $username, $password, $owner_email, $list_name;
echo "
<form method=\"post\">
<input type=\"hidden\" name=\"username\" value=\"$username\">
<input type=\"hidden\" name=\"password\" value=\"$password\">
<input type=\"hidden\" name=\"action\" value=\"admin\">
<input type=\"hidden\" name=\"q\" value=\"send_msg_confirm\">
<table align=\"center\" border=\"0\">
<tr><td colspan=\"2\" align=\"center\" valign=\"top\"><font face=\"verdana,arial,helvetica\" size=\"+1\"><b>Send A Message:</b></font><br>&nbsp;</td></tr>
<tr><td align=\"left\" valign=\"top\"><font face=\"verdana,arial,helvetica\"><b>From: </b></font></td><td align=\"left\" valign=\"top\"><font face=\"verdana,arial,helvetica\">\"$list_name\" &lt;$owner_email&gt;</font></td></tr>
<tr><td align=\"left\" valign=\"top\"><font face=\"verdana,arial,helvetica\"><b>Subject: </b></font></td><td align=\"left\" valign=\"top\"><input type=\"text\" name=\"subject\" size=\"35\"></td></tr>
<tr><td align=\"left\" valign=\"top\"><font face=\"verdana,arial,helvetica\"><b>Message: </b></font></td><td align=\"left\" valign=\"top\"><textarea rows=\"15\" cols=\"50\" name=\"message\"></textarea></td></tr>
<tr><td></td><td align=\"left\" valign=\"top\"><input type=\"submit\" value=\"Send\">&nbsp;<input type=\"reset\" value=\"Clear\"></td></tr></table>
</form>
";
}

function admin_send_msg_confirm() {
// Confirms the message before sending.
global $username, $password, $subject, $message, $owner_email, $list_name, $list_file;
$file = @file($list_file);
$count = count($file);
echo "
<form method=\"post\">
<input type=\"hidden\" name=\"username\" value=\"$username\">
<input type=\"hidden\" name=\"password\" value=\"$password\">
<input type=\"hidden\" name=\"message\" value=\"$message\">
<input type=\"hidden\" name=\"subject\" value=\"$subject\">
<input type=\"hidden\" name=\"action\" value=\"admin\">
<input type=\"hidden\" name=\"q\" value=\"send_msg\">
<table align=\"center\" border=\"0\">
<tr><td colspan=\"2\" align=\"center\" valign=\"top\"><font face=\"verdana,arial,helvetica\"><font size=\"+1\"><b>Please Confirm this is what you wish to send:</b></font><br>The following message will be sent to $count subscribers.</font><br>&nbsp;</td></tr>
<tr><td align=\"left\" valign=\"top\"><font face=\"verdana,arial,helvetica\"><b>From: </b></font></td><td align=\"left\" valign=\"top\"><font face=\"verdana,arial,helvetica\">\"$list_name\" &lt;$owner_email&gt;</font></td></tr>
<tr><td align=\"left\" valign=\"top\"><font face=\"verdana,arial,helvetica\"><b>Subject: </b></font></td><td align=\"left\" valign=\"top\"><font face=\"verdana,arial,helvetica\">$subject</font></td></tr>
<tr><td align=\"left\" valign=\"top\"><font face=\"verdana,arial,helvetica\"><b>Message: </b></font></td><td align=\"left\" valign=\"top\"><pre><font face=\"verdana,arial,helvetica\">$message</font></pre></td></tr>
<tr><td></td><td align=\"left\" valign=\"top\"><input type=\"submit\" value=\"Send\">&nbsp;<input type=\"reset\" value=\"Edit\" OnClick=\"history.go(-1); return true;\"></td></tr></table>
</form>";

}

function admin_send_msg() {
// Sends the message to all subscribers on the list.
global $list_name, $list_file, $owner_email, $msg_footer, $message, $subject;
$headers = "From: \"$list_name\" <$owner_email>\nReply-To: $owner_email\nX-Mailer: PHPMailList http://php.warpedweb.net/";
$file = @file($list_file);
if ($file) {
foreach ($file as $address) {
$address = trim($address);
$headers .= "\nBcc: $address";
}
if (mail($owner_email, $subject,$message, $headers)) {
echo "<center><font face=\"verdana,arial,helvetica\"><b>Mensagem enviada com sucesso.</b></font></center>";
}
}
else {
echo "<center><font face=\"verdana,arial,helvetica\"><b>Não foi possível abrir a lista.</b><br>Cheque os paths e as permissões.</font></center>";
}
}


function admin_view_subs() {
// Prints the list of subscribers.
global $list_file;
$file = @file($list_file);
if ($file) {
sort($file);
$count = count($file);
echo "<center><font face=\"verdana,arial,helvetica\" size=\"+1\"><bSeu e-mail:</b></font><br><font face=\"verdana,arial,helvetica\" size=\"-1\">Voc6e tem $count e-mails cadastrados.<br>&nbsp;</font></center>";
echo "<table border=\"1\" align=\"center\" bordercolor=\"black\" cellspacing=\"0\" cellpadding=\"2\">\n<tr><td align=\"center\" bgcolor=\"#999999\"><font face=\"verdana,arial,helvetica\"><b>#</b></font></td><td align=\"center\" bgcolor=\"#999999\"><font face=\"verdana,arial,helvetica\"><b>Addresses</b></font></td></tr>";
foreach ($file as $key => $address) {
$address = trim($address);
$key++;
echo "<tr><td align=\"center\"><font face=\"verdana,arial,helvetica\" size=\"-1\">$key</font></td><td align=\"center\"><font face=\"verdana,arial,helvetica\" size=\"-1\">$address</font></td></tr>";
}
echo "</table>";
}
else {
echo "<center><font face=\"verdana,arial,helvetica\"><b>Não foi possível abrir a lista.</b><br>Não tem ninguém cadastrado.</font></center>";
}
}

function admin_print_options() {
// Prints the administration options.
global $username, $password;
echo "
<form method=\"post\">
<input type=\"hidden\" name=\"username\" value=\"$username\">
<input type=\"hidden\" name=\"password\" value=\"$password\">
<input type=\"hidden\" name=\"action\" value=\"admin\">
<table border=\"0\" align=\"center\" cellspacing=\"0\" cellpadding=\"1\">
<tr><td colspan=\"2\"><font face=\"verdana,arial,helvetica\" size=\"+1\"><br><b>ICQuente News Admin</b></font></td></tr>
<tr><td><input type=\"radio\" name=\"q\" value=\"write_msg\"></td><td><font face=\"verdana,arial,helvetica\">Enviar Mensagem.</font></td></tr>
<tr><td><input type=\"radio\" name=\"q\" value=\"view_subs\"></td><td><font face=\"verdana,arial,helvetica\">Ver cadastrados</font></td></tr>
<tr><td><input type=\"radio\" name=\"q\" value=\"sub_unsub\"></td><td><font face=\"verdana,arial,helvetica\">Adicionar/remover e-mails</font></td></tr>
<tr><td></td><td><input type=\"submit\" value=\"Submit\"></form></td></tr></table>";
}

function print_subscribe_form() {
// Prints the subscription form.
global $list_name;
echo("<head><title>PHPMailList</title></head><body><form method=\"post\"><center><font face=\"verdana,arial,helvetica\">Adicionar ao:<br><b>$list_name</b></font></center><table border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">
<tr><td rowspan=\"2\"><input type=\"text\" name=\"email\" value=\"Your Email Address\" size=\"20\"></td>
<td><input type=\"radio\" name=\"action\" value=\"sub\" checked><font face=\"verdana,arial,helvetica\" size=\"-1\">&nbsp;Adicionar</font></td></tr>
<tr><td><input type=\"radio\" name=\"action\" value=\"unsub\"><font face=\"verdana,arial,helvetica\" size=\"-1\">&nbsp;Remover</font></td></tr>
<tr><td colspan=\"2\" align=\"center\" valign=\"center\"><input type=\"submit\" value=\"Enviar\"></td></tr>
</table></form>");
}

function print_footer() {
// Prints the footer.
global $version;
echo("<br><font face=\"verdana, arial, helvetica\"><center><b>ICQuente News</b>\n<br>Desenvolvido por: <A HREF=\"mailto:diegodesigner@icquente.com\">Diego S. Mascarenhas</A>.
<br><A HREF=\"http://www.icquente.com/diegodesigner/\"><i>http://www.icquente.com/diegodesigner</i></A>
<br>Versão $version</center></font>");
}
function admin_print_logon($msg) {
// Prints the logon screen.
echo "<form method=\"post\"><center><font face=\"arial\"><b>$msg</b><br><br></font></center>
<table border=\"0\" align=\"center\"><tr><td colspan=\"2\" align=\"center\"><font face=\"arial\"><b>Login:</b></font></td></tr><tr><td><font face=\"arial\">Usuário:</font></td><td><input type=\"text\" name=\"username\"></td></tr>
<tr><td><font face=\"arial\">Senha:</font></td><td><input type=\"password\" name=\"password\"></td></tr>
<tr><td></td><td><input type=\"submit\" value=\"Entrar\"></td></tr></table></form>";
}
?>
"

heheheh
Você precisa estar logado no PHPBrasil.com para poder enviar mensagens para os nossos fóruns.

Faça o login aqui.