Enviar E-Mail Com Anexo (Atualizado!)
#46
Posted 19/01/2007, 08:30
Lá você pode até achar o que quer pronto. Dá uma passada lá.
Flws...
Até mais
#47
Posted 31/01/2007, 21:42
Seguinte ele ta funcionando só qdo envio o arquivo em anexo... ou só qdo mando um texto em formato html.. com cores e formatações..
Mas qdo envio os 2 juntos.. texto em html e anexo ele nao funciona direito..
Tipo o texto e o anexo ate q vai.. so q o texto fica todo em codigo fonte.. ele nao quebra pro formato html com cores e tal no outlook...
Creio q o problema seja bem nessa linha...
$headers .= "Content-type: multipart/mixed; boundary=\"$boundary\"\r\n";
Pq qdo mudo para...
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
Dai funciona... mas so o texto em html.. e o anexo ai nao vai...
Tem algum comando pra uni os "dois"?? sei la ja fiz varios testes aqui..
tipo ja fiz gambiarras como... Content-type: multipart/mixed/text/html... mas nao funcionou...
Ja estou a 2 dias nisso pesquisando na internet e nada...
qdo encontro algo.. quase todos os foruns tem esse msm scripts.. alguns so com umas modificações
Se alguem souber algo aki de como revolver isso.. por favor me ajude!!!
http://www.plugcidade.com.br
|| PLUG BALADA || - O portal de festas do vale do Rio Pardo
http://www.plugbalada.com.br
#48
Posted 01/02/2007, 06:19
$headers .= "Content-type: multipart/mixed; charset=iso-8859-1; boundary=\"$boundary\"\r\n";
Flws...
Até mais
#49
Posted 01/02/2007, 10:55
Experimente isto:
$headers .= "Content-type: multipart/mixed; charset=iso-8859-1; boundary=\"$boundary\"\r\n";
Flws...
OK vlw Frenesi.. mas ainda nao deu certo
Continuo recebendo o email com o texto em codigo.. o anexo vai certinho.. mas o texto em html nao..
Olha como recebo aki no meu outlook
'<p align=\"center\"><font size=\"4\" color=\"#cc0000\"> Teste</font></p><p> </p><p><font color=\"#0000cc\"><strong>testando......</strong></font></p><p>asdasdasdsad<br />qweqwwqew<br />zzzzzzzzzzzzzzzzzzz</p><p> </p>'
Tipo se eu manda so esse texto assim dai recebo aki no outlook certinho em formato html com cores e tal...
mas agora se mando um anexo e + esse texto junto.. ai nao rola...
E agora o que pode ser feito para arrumar isso???
Por favor me deem um HELP, estou precisando muito msm desse script para poder funcionar meu sistema de Newslleter aqui q eu estou fazendo.
http://www.plugcidade.com.br
|| PLUG BALADA || - O portal de festas do vale do Rio Pardo
http://www.plugbalada.com.br
#50
Posted 01/02/2007, 11:46
Flws...
Até mais
#51
Posted 01/02/2007, 13:43
mas seguinte.. acho q nao eh meu programa nao..
pq testei aki no outlook express.. e no microsoft outlook.. e ainda continua mandando esses codigos qdo mando um anexo junto...
claro q se eu for ver o email em um browser de internet .. como por exemplo se eu visualizar o email aki no gmail.. dai sim o texto aparece certinho na pagina como html... e o anexo junto...
mas agora se eu vejo o msm email no outlook.. testei varios outros emails tb... ate d dominios proprios meu..e ainda assim nao funciona.
tipo eh como se tivesse faltando algum comando como disse antes...
dai se eu coloco essa linha aki...
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
no lugar dessa outra...
$headers .= "Content-type: multipart/mixed;
nesse teu script dai funciona o texto em html.. so q o anexo nao vai neh...
tipo eu queria q funcionasse tanto para o internet explorer como para outlook.. pq como disse eh pra um sistema d newslleter q estou criando aki... e dai manda pra varias pessoas ao msm tempo.. e alguns podem estar usando o outlook
kra te adicionei aki no MSN.. se vc puder me aceita ai pra conversar...
se alguem souber algo me de uma luz...
vlw galeraaa!!!!
Tipo... vc ja chegou a testar esse seu script.. mandando texto em formato "html" com cores e formatações... e anexo junto???
e tentou receber ele no outlook pra ver se recebe tudo certinho????
http://www.plugcidade.com.br
|| PLUG BALADA || - O portal de festas do vale do Rio Pardo
http://www.plugbalada.com.br
#52
Posted 13/02/2007, 11:33
Estou mesmo precisando disso.
http://www.plugcidade.com.br
|| PLUG BALADA || - O portal de festas do vale do Rio Pardo
http://www.plugbalada.com.br
#53
Posted 19/03/2007, 16:09
#54
Posted 22/04/2008, 01:16
plotagem.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>KADNEWS | Projetando a Evolução | Fale Conosco</title> <link href="borda.css" rel="stylesheet" type="text/css" /> <style type="text/css"> <!-- @import url("texto.css"); @import url("mini.css"); --> </style> </head> <body bgcolor="#e4e4e4" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"> <table width="100%" height="200" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <th align="center" valign="top" nowrap="nowrap" background="kadtop2.jpg" scope="col"><table width="760" height="200" border="0" cellpadding="0" cellspacing="0"> <tr> <th scope="col"><img src="kadtop3.jpg" width="760" height="200" border="0" usemap="#Map" /></th> </tr> </table></th> </tr> </table> <table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF"> <tr> <th scope="col"><table width="750" height="100%" border="0" align="center" cellpadding="0" cellspacing="5" class="borda"> <tr> <th scope="col"><form action="envia2.php" method="post" enctype="multipart/form-data" name="form2" id="form2"> <table width="730" border="0" cellspacing="0" cellpadding="0"> <tr> <th colspan="4" scope="col"> </th> </tr> <tr> <td colspan="2" class="subtit">Fale Conosco Plotagem: </td> <td width="274" colspan="2" rowspan="11" align="right"><img src="contato.jpg" width="274" height="283" /></td> </tr> <tr> <td width="134"> </td> <td> </td> </tr> <tr> <td class="texto"><div align="right">Nome:</div></td> <td width="322" align="left"><label> <input name="nome" type="text" class="texto" id="nome" size="60" /> </label></td> </tr> <tr> <td class="texto"><div align="right"></div></td> <td class="texto"> </td> </tr> <tr> <td class="texto"><div align="right">E-mail:</div></td> <td align="left"><label> <input name="email" type="text" class="texto" id="email" size="60" /> </label></td> </tr> <tr> <td class="texto"><div align="right"></div></td> <td class="texto"> </td> </tr> <tr> <td valign="top" class="texto"><div align="right">Comentário:</div></td> <td align="left"><label> <input name="plot" type="file" class="texto" id="plot" size="48" /> </label></td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td> </td> <td align="left"><label> <input name="enviar" type="submit" class="fundo" id="enviar" value="Enviar" /> </label></td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td valign="bottom"><div align="left"><a href="index.html" class="mini">· voltar ·</a></div></td> <td> </td> </tr> <tr> <td colspan="4"> </td> </tr> </table> </form> </th> </tr> </table></th> </tr> </table> <table width="100%" height="92" border="0" cellpadding="0" cellspacing="0" background="kadtop4.jpg"> <tr> <th valign="bottom" scope="col"><table width="760" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td><img src="kadtop5.jpg" width="760" height="92" border="0" usemap="#Map2" /></td> </tr> </table></th> </tr> </table> <map name="Map" id="Map"> <area shape="rect" coords="111,27,352,155" href="index.html" /> <area shape="rect" coords="371,162,418,186" href="index.html" /> <area shape="rect" coords="424,163,491,186" href="#" /> <area shape="rect" coords="498,162,563,189" href="kadcli.html" /> <area shape="rect" coords="676,161,740,190" href="kadfale.html" /> <area shape="rect" coords="577,162,663,187" href="kadonde.html" /> </map> <map name="Map2" id="Map2"><area shape="rect" coords="717,22,739,45" href="http://thiagoacioli.blogspot.com" target="_blank" /> </map></body> </html>
Envia2.php:
<? $mail = $_POST["email"]; $message = "Nome :".$_POST["nome"]."<br>"; $message .= "E_mail :".$mail."<br>"; $message .= "Comentário :".$_POST["texto"]."<br>"; $subject = "Formulário recebido"; $anexo = $_POST["plot"]; if ($action != "upload"){ $mime_list = array("html"=>"text/html","htm"=>"text/html", "txt"=>"text/plain", "rtf"=>"text/enriched","csv"=>"text/tab-separated-values","css"=>"text/css","gif"=>"image/gif"); $ABORT = FALSE;$boundary = "XYZ-" . date(dmyhms) . "-ZYX"; $message = "--$boundary\n"; $message .= "Content-Transfer-Encoding: 8bits\n"; $message .= "Content-Type: text/plain; charset=\"ISO-8859-1\"\n\n"; $message .= $body;$message .= "\n";$attachments[1] = $anexo; foreach ($attachments as $key => $full_path) { if ($full_path !='') { if (file_exists($full_path)){ if ($fp = fopen($full_path,"rb")) { $filename = array_pop(explode(chr(92),$full_path)); $contents = fread($fp,filesize($full_path)); $encoded = base64_encode($contents); $encoded_split = chunk_split($encoded); fclose($fp); $message .= "--$boundary\n"; $message .= "Content-Type: $anexo_type\n"; $message .= "Content-Disposition: attachment; filename=\"$anexo_name\" \n"; $message .= "Content-Transfer-Encoding: base64\n\n"; $message .= "$encoded_split\n"; } else { echo "Impossível abrir o arquivo$key: $filename"; $ABORT = TRUE; } } else { echo "O arquivo$key não existe: $filename"; $ABORT = TRUE; }}} $message .= "--$boundary--\r\n"; $headers = "MIME-Version: 1.0\n"; $headers .= "From: <$from>\r\n"; $headers .= "Content-type: multipart/mixed; boundary=\"$boundary\"\r\n"; $mensagem=mail("mzaidan@gmail.com", $subject, $message, $headers); if ($mensagem) { print "Mensagem enviada!";} else { print "O envio da mensagem falhou!";}} ?>
Minha Foto
"Não temas,segue adiante,não olhes para trás!!
Segura na mão de Deus e vai.."
#55
Posted 20/06/2008, 10:25
Espero que alguém possa ajudar
#56
Posted 20/06/2008, 10:44
$mensagem=mail("qualquerum@email.com", $subject, $message, $headers);
Flws...
Até mais
#57
Posted 23/09/2008, 16:52
Tentei inserir umas tags mas não deu certo XD
[codebox]$headers = "<html>";
$headers .= "<body>";
$headers .= "<Img src='http://yuyuphp.6te.net/dbz/layout/lay_03b.jpg'>\r\n";
$headers .= "<br>Banner.</br>";
$headers .= "</body>";
$headers .= "</html>";[/codebox]
O que devo fazer para isso dar certo?
Agradeço a atenção de todos!
#58
Posted 25/04/2009, 18:29
Como Fazer com que o preenchimento de alguns campos sejam obrigatórios?
Abraços
Paulo
#59
Posted 21/05/2009, 11:02
Ae, sou novato nisso ainda. Eu tentei usar aqui e nao deu. Vejam como eu coloquei:
<FORM METHOD="post" ENCTYPE="multipart/form-data">
<INPUT TYPE="hidden" NAME="MAX_FILE_SIZE" VALUE="1000000">
<INPUT TYPE="hidden" NAME="action" VALUE="upload">
<TABLE BORDER="1">
<TR>
<TD>De: </TD>
<TD><input type="text" name="from" size=40><BR></TD>
</TR>
<TR>
<TD>Para: </TD>
<TD><input type="text" name="to" size=40><BR></TD>
</TR
<TR>
<TD>Assunto: </TD>
<TD><input type="text" name="subject" size=40><BR></TD>
</TR
<TR>
<TD>Cc: </TD>
<TD><input type="text" name="cc" size=40><BR></TD>
</TR
<TR>
<TD>Bcc: </TD>
<TD><input type="text" name="bcc" size=40><BR></TD>
</TR
<TR>
<TD>Mensagem: </TD>
<TD><TEXTAREA NAME="body" ROWS="10" COLS="50"></TEXTAREA></TD>
</TR>
<TR>
<TD>Anexo: </TD>
<TD><INPUT TYPE="file" NAME="anexo"></TD>
</TR>
<TR>
<TD COLSPAN="2"><INPUT TYPE="submit" VALUE="Enviar"></TD>
</TR>
</TABLE>
</FORM>
<?
if ($action = "upload")
{
$mime_list = array("html"=>"text/html","htm"=>"text/html", "txt"=>"text/plain", "rtf"=>"text/enriched","csv"=>"text/tab-separated-values","css"=>"text/css","gif"=>"image/gif");
$ABORT = FALSE;
$boundary = "XYZ-" . date(dmyhms) . "-ZYX";
$message = "--$boundary\n";
$message .= "Content-Transfer-Encoding: 8bits\n";
$message .= "Content-Type: text/plain; charset=\"ISO-8859-1\"\n\n";
$message .= $body;
$message .= "\n";
$attachments[1] = $anexo;
foreach ($attachments as $key => $full_path) {
if ($full_path !='') {
if (file_exists($full_path)){
if ($fp = fopen($full_path,"rb")) {
$filename = array_pop(explode(chr(92),$full_path));
$contents = fread($fp,filesize($full_path));
$encoded = base64_encode($contents);
$encoded_split = chunk_split($encoded);
fclose($fp);
$message .= "--$boundary\n";
$message .= "Content-Type: $anexo_type\n";
$message .= "Content-Disposition: attachment; filename=\"$anexo_name\" \n";
$message .= "Content-Transfer-Encoding: base64\n\n";
$message .= "$encoded_split\n";
}
else {
echo "Impossível abrir o arquivo$key: $filename";
$ABORT = TRUE;
}
}
else {
echo "O arquivo$key não existe: $filename";
$ABORT = TRUE;
}
}
}
$message .= "--$boundary--\r\n";
$headers = "MIME-Version: 1.0\n";
$headers .= "From: <$from>\r\n";
$headers .= "Content-type: multipart/mixed; boundary=\"$boundary\"\r\n";
$mensagem=mail($to, $subject, $message, $headers);
if ($mensagem) {
print "Mensagem enviada!";
} else {
print "O envio da mensagem falhou!";
}
}
?>
E deu errado pq o email nao é confirmado...
se alguém puder me ajudar, eu agradeceria mto!
valeu
Ok, vc conseguiu. Me explique onde está configurado seu e-mail para receber o arquivo anexado pelo usuário.
#60
Posted 26/05/2009, 13:04
0 user(s) are reading this topic
0 membro(s), 0 visitante(s) e 0 membros anônimo(s)