Anexar arquivo ao e-mail
Não sei o a está acontecendo ao anexar o arquivo ao e-mail, está dando erro.
o e-mail é enviado mais o arquivo não fica em anexo, ao inves disso fica uns codigos no lugar do arquivo como abaixo.
Nome: xxxx
Data: 20/04/2012
Email: xxxxx@xxxxx.com
Cidade: Curitiba
Assunto: TRABALHE CONOSCO
VISUALIZAR O AQUIVO
--XYZ-200420120246-ZYX
Content-Type: application/msword
Content-Disposition: attachment; filename="artigoMKT03.doc"
Content-Transfer-Encoding: base64
0M8R4KGxGuEAAAAAAAAAAAAAAAAAAAAAPgADAP7/CQAGAAAAAAAAAAAAAAABAAAALgAAAAAAAAAA
EAAAMAAAAAEAAAD+////AAAAAC0AAAD/////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////s
pcEAcQAWBAAACBK/AAAAAAAAEAAAAAAABAAA3AoAAA4AYmpianQrdCsAAAAAAAAAAAAAAAAAAAAA
AAAWBBYALRgAABZBAQAWQQEA3AYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD//w8AAAAA
AAAAAAD//w8AAAAAAAAAAAD//w8AAAAAAAAAAAAAAAAAAAAAAF0AAAAAALYAAAAAAAAAtgAAALYA
AAAAAAAAtgAAAAAAAAC2AAAAAAAAALYAAAAAAAAAtgAAABQAAAAAAAAAAAAAAMoAAAAAAAAAygAA
AAAAAADKAAAAAAAAAMoAAAAAAAAAygAAAAwAAADWAAAADAAAAMoAAAAAAAAA9wEAAPwAAADuAAAA
segue o codigo q utilizei pra anexar.
//corpo do email
$email_conteudo = implode ( "\n",array ( "Content-Type: text/html;","Content-Transfer-Encoding: quoted-printable"));
$email_conteudo = "Nome: $nome \n";
$email_conteudo .= "Data: ".date("d/m/Y");
$email_conteudo .= "\n Email: $email \n";
$email_conteudo .= "Cidade: $cidade \n";
$email_conteudo .= "Assunto: TRABALHE CONOSCO \n";
$email_conteudo .= "VISUALIZAR O AQUIVO \n";
$email_conteudo .= "--$boundary \n";
//Anexo
$email_conteudo .= "Content-Type: ".$arquivo["type"]."\n";
$email_conteudo .= "Content-Disposition: attachment; filename=\"".$arquivo["name"]."\"\n";
$email_conteudo .= "Content-Transfer-Encoding: base64\n\n";
$email_conteudo.= "$anexo\n";
//====================================================
mail ($email_destinatario, $email_assunto, nl2br($email_conteudo), $headers)
o e-mail é enviado mais o arquivo não fica em anexo, ao inves disso fica uns codigos no lugar do arquivo como abaixo.
Nome: xxxx
Data: 20/04/2012
Email: xxxxx@xxxxx.com
Cidade: Curitiba
Assunto: TRABALHE CONOSCO
VISUALIZAR O AQUIVO
--XYZ-200420120246-ZYX
Content-Type: application/msword
Content-Disposition: attachment; filename="artigoMKT03.doc"
Content-Transfer-Encoding: base64
0M8R4KGxGuEAAAAAAAAAAAAAAAAAAAAAPgADAP7/CQAGAAAAAAAAAAAAAAABAAAALgAAAAAAAAAA
EAAAMAAAAAEAAAD+////AAAAAC0AAAD/////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////s
pcEAcQAWBAAACBK/AAAAAAAAEAAAAAAABAAA3AoAAA4AYmpianQrdCsAAAAAAAAAAAAAAAAAAAAA
AAAWBBYALRgAABZBAQAWQQEA3AYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD//w8AAAAA
AAAAAAD//w8AAAAAAAAAAAD//w8AAAAAAAAAAAAAAAAAAAAAAF0AAAAAALYAAAAAAAAAtgAAALYA
AAAAAAAAtgAAAAAAAAC2AAAAAAAAALYAAAAAAAAAtgAAABQAAAAAAAAAAAAAAMoAAAAAAAAAygAA
AAAAAADKAAAAAAAAAMoAAAAAAAAAygAAAAwAAADWAAAADAAAAMoAAAAAAAAA9wEAAPwAAADuAAAA
segue o codigo q utilizei pra anexar.
//corpo do email
$email_conteudo = implode ( "\n",array ( "Content-Type: text/html;","Content-Transfer-Encoding: quoted-printable"));
$email_conteudo = "Nome: $nome \n";
$email_conteudo .= "Data: ".date("d/m/Y");
$email_conteudo .= "\n Email: $email \n";
$email_conteudo .= "Cidade: $cidade \n";
$email_conteudo .= "Assunto: TRABALHE CONOSCO \n";
$email_conteudo .= "VISUALIZAR O AQUIVO \n";
$email_conteudo .= "--$boundary \n";
//Anexo
$email_conteudo .= "Content-Type: ".$arquivo["type"]."\n";
$email_conteudo .= "Content-Disposition: attachment; filename=\"".$arquivo["name"]."\"\n";
$email_conteudo .= "Content-Transfer-Encoding: base64\n\n";
$email_conteudo.= "$anexo\n";
//====================================================
mail ($email_destinatario, $email_assunto, nl2br($email_conteudo), $headers)
comentários (0)
suspender
Lista de Respostas:
26/04/2012 6:58pm
(~12 anos atrás)
(~12 anos atrás)
Use uma boa classe de envio de email como a PHPmailer ou a SwiftMailer.
Isso evita um monte de problemas com headers.
Isso evita um monte de problemas com headers.