Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

Frankie Hummel

Como enviar um email criado em HTML no php

Recommended Posts

Olá pessoal,

 

Estou precisando mandar um email do meu sistema para um cliente ai baixei desse site: https://www.campaignmonitor.com/email-templates/all/

 

um modelo template que achei bem legal, coloquei as imagens em uma hospedagem online que tenho e fiz o teste com o html puro. funcionou de boa daí em tento colocar ele no código e quando o php envia chega na caixa de email tudo desconfigurado o que pode ser? Estou fazendo assim:

<?php

        $email 		= "eduardo12fox@gmail.com";//$_GET['EMAIL'];
        
		
		
        //REMETENTE --> ESTE EMAIL TEM QUE SER VALIDO DO DOMINIO
        //====================================================
        $email_remetente = "flexbyou@flexbyou.com.br"; // deve ser um email do dominio
        //====================================================
 
 
        //Configura��es do email, ajustar conforme necessidade
        //====================================================
        $email_destinatario = "$email"; // qualquer email pode receber os dados
        $email_reply = "$email";
        $email_assunto = "Email de cancelamento de contrato  do contrato: ";
        //====================================================
 
 
        //Monta o Corpo da Mensagem
        //====================================================
        
        $email_conteudo  =  '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Email Template - Classic</title>
<style type="text/css">
a:hover { text-decoration: underline !important; }
.issue p {font-size: 36px; font-family: Georgia, Times, serif; color: #ffffff; margin-top: 0px; margin-bottom: 0px; text-shadow: 1px 1px 1px #333;}
.title h1 { color: #333 !important; margin-top: 0px; margin-bottom: 0px; font-weight: normal; font-size: 48px; font-family: Georgia, Times, serif }
.date p { font-size: 24px; font-family: Georgia,  Times, serif; color: #ffffff; margin-top: 0px; margin-bottom: 0px;}
.content h1 { font-size: 24px; font-family: Georgia, "Times New Roman", Times, serif; color: #333333 !important; margin-top: 0px; margin-bottom: 12px;}
.content p { font-size: 16px; line-height: 22px; font-family: Georgia, Times, serif; color: #333; margin: 0px;}
.content a { color: #bc1f31; text-decoration: none;}
.address p {font-size: 14px; line-height: 24px; font-family: Georgia, Times, serif; color: #b0a08b; margin: 0px;}
</style>
</head>

<body marginheight="0" topmargin="0" marginwidth="0" style="margin: 0px; background-color: #f7f2e4;" bgcolor="#f7f2e4" leftmargin="0">
<!--100% body table-->
<table cellspacing="0" border="0" cellpadding="0" width="100%" bgcolor="#f7f2e4">
	<tr>
		<td>
			<!--top links-->
			<table width="100%" border="0" cellspacing="0" cellpadding="0">
				<tr>
					<td valign="middle" align="center" height="45">
						<p style="font-size: 14px; line-height: 24px; font-family: Georgia, "Times New Roman", Times, serif; color: #b0a08b; margin: 0px;">
							Is this email not displaying correctly? <webversion style="color: #bc1f31; text-decoration: none;">Try the web version.</webversion></p></td>
						</tr>
					</table>
					<!--header-->
					<table style="background:url(images/header-bg.jpg); background-repeat: no-repeat; background-position: center; background-color: #fffdf9;" width="684" border="0" align="center" cellpadding="0" cellspacing="0">
						<tr>
							<td>
								<table width="100%" border="0" cellspacing="0" cellpadding="0">
									<tr>
										<td valign="top" width="173">
											<!--ribbon-->
											<table border="0" cellspacing="0" cellpadding="0">
												<tr>
													<td height="120" width="45"></td>
													<td background="images/ribbon.jpg" valign="top" bgcolor="#c72439" height="120" width="80">
														<table width="100%" border="0" cellspacing="0" cellpadding="0">
															<tr>
																<td valign="bottom" align="center" height="35">
																	<p style="font-size: 14px; font-family: Georgia, "Times New Roman", Times, serif; color: #ffffff; margin-top: 0px; margin-bottom: 0px;">ISSUE</p>
																</td>
															</tr>
															<tr>
																<td valign="top" align="center" class="issue">
																	<p><singleline label="Title">31</singleline></p>
																</td>
															</tr>
														</table>
													</td>
												</tr>
											</table><!--ribbon-->
										</td>
										<td valign="middle" width="493"><table width="100%" border="0" cellspacing="0" cellpadding="0">
											<tr>
												<td height="60"></td>
											</tr>
											<tr>
												<td class="title">
													<h1><singleline label="Title">Enter </singleline></h1>
												</td>
											</tr>
											<tr>
												<td height="40">
												</td>
											</tr>
										</table>
										<!--date-->
										<table border="0" cellspacing="0" cellpadding="0">
											<tr>
												<td valign="top" align="center" bgcolor="#312c26" background="images/date-bg.jpg" width="357" height="42" class="date">
													<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td height="5"></td></tr></table>
													<p><currentmonthname /> <currentyear /></p>
												</td>
											</tr>
										</table><!--/date-->
									</td>
									<td width="18"></td>
								</tr>
							</table>
						</td>
					</tr>
				</table><!--/header-->
				<!--email container-->
				<table bgcolor="#fffdf9" cellspacing="0" border="0" align="center" cellpadding="30" width="684">
					<tr>
						<td>
							<!--email content-->
							<table cellspacing="0" border="0" id="email-content" cellpadding="0" width="624">
								<tr>
									<td>
										<!--section 3-->
										<table cellspacing="0" border="0" cellpadding="0" width="100%">
											<tr>
												<td class="content">
													<!--line break-->
													<table cellspacing="0" border="0" cellpadding="0" width="100%">
														<tr>
															<td height="72"><img src="http://www.flexbyou.com.br/Contrato/teste_img/line-break-2.jpg" width="622" height="72" /></td>
														</tr>
													</table><!--/line break-->
													<repeater>
														<table cellspacing="0" border="0" cellpadding="0" width="100%">
															<tr>
																<td valign="top" width="378">
																	<h1><singleline label="Title">Enter Title Here</singleline></h1>
																<img align="right" alt="img8" style="margin: 0 0 10px 10px; border: solid 1px #FFF; box-shadow: 2px 2px 6px #333; -webkit-box-shadow: 2px 2px 6px #333; -khtml-box-shadow: 2px 2px 6px #333; -moz-box-shadow: 2px 2px 6px #333; float: right;" width="216" editable="true" label="Image" />
																<multiline label="Description"><p>Enter content here.</p></multiline>
																</td>
															</tr>
														</table>
														<!--line break-->
														<table width="100%" border="0" cellspacing="0" cellpadding="0">
															<tr>
																<td valign="bottom" height="50"><img src="http://www.flexbyou.com.br/Contrato/teste_img/line-break.jpg" width="622" height="27" /></td>
															</tr>
														</table><!--/line break-->
													</repeater>

													<table cellspacing="0" border="0" cellpadding="0" width="100%">
														<tr>
															<td height="72"><img src="http://www.flexbyou.com.br/Contrato/teste_img/line-break-2.jpg" width="622" height="72" />
															</td>
														</tr>
													</table><!--/line break-->
												</td>
											</tr>
										</table><!--/section 3-->
									</td>
								</tr>
							</table><!--/email content-->
						</td>
					</tr>
				</table><!--/email container-->
				<!--footer-->
				<table width="680" border="0" align="center" cellpadding="30" cellspacing="0">
					<tr>
						<td valign="top">
							<p style="font-size: 14px; line-height: 24px; font-family: Georgia, "Times New Roman", Times, serif; color: #b0a08b; margin: 0px;">
								<singleline label="Title">You are receiving this newsletter because you bought widgets from us.</singleline><br /> 
								Not interested anymore? <unsubscribe style="color: #bc1f31; text-decoration: none;">Unsubscribe.</unsubscribe></p>
							</td>
							<td valign="top" class="address" width="245"><multiline label="Description"><p>ABCWidgets Corp - 123 Some Street, City, ST 99999. ph +1 4 1477 89 745.</p></multiline>
							</td>
						</tr>
						<tr>
							<td height="30"></td>
							<td height="30"></td>
						</tr>
					</table><!--/footer-->
				</td>
			</tr>
		</table><!--/100% body table-->
</body>
</html>';
        //====================================================
 
 
        //Seta os Headers (Alerar somente caso necessario)
        //====================================================
        $email_headers = implode ( "\n",array ( "From: $email_remetente", "Reply-To: $email_reply", "Subject: $email_assunto","Return-Path:  $email_remetente","MIME-Version: 1.0","X-Priority: 3","Content-Type: text/html; charset=UTF-8" ) );
        //====================================================
 
 
        //Enviando o email
        //====================================================
        if (mail ($email_destinatario, $email_assunto, nl2br($email_conteudo), $email_headers)){
                echo "</b>E-Mail enviado com sucesso!</b>";
        }
        else{
                echo "</b>Falha no envio do E-Mail!</b>";
        }
        //====================================================


?>

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.