Ir para conteúdo

POWERED BY:

Arquivado

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

Rogerio Pancini

Fazer uma função com algumas linhas do PhpMailer

Recommended Posts

Boa noite pessoal.

 

Esse é sonho de consumo, nunca consegui parar para estudar como fazer... mas, chegou a hora.

Uso o PhpMailer para enviar e-mail pelo site.

Eu customizei o zero um template de e-mail, pois o retorno dos formulários de contato estava utilizando texto.

Na unha está funcionando muito bem, mas gostaria de otimizar o processo, pois para todos os formulário, tenho que configurar o script de e-mail.

A solução mais viável é fazer uma function.

 

Eu fiz, e parece que vai dar certo.

 

A dúvida que fique é que preciso começar com o parâmetro do PhpMailer ($mail->Body       = ') e depois concatenar em algumas partes do construtor do e-mail.

Vou colocar o que eu fiz até agora, mas o bo está no return.

Será que minha ideia é possível de ser executada?

 

Obrigado!!

 

PS: O "1, 1, 1, 1" abaixo é só teste, desconsiderem.

<?php
	function corpo_email($empresa_sel, $cor_topo_sel, $cor_rodape_sel, $cor_topo_sel, $site_sel, $logo_sel, $titulo_sel, $nome, $email, $telefone, $mensagem, $data, $hora, $empresa_sel, $cor_rodape_sel, $site_sel, $site_link, $config) {
		
		$mail->Body       = '
				<!doctype html>
					<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
						<head>
						<!-- NAME: FOLLOW UP -->
						<!--[if gte mso 15]>
						<xml>
							<o:OfficeDocumentSettings>
							<o:AllowPNG/>
							<o:PixelsPerInch>96</o:PixelsPerInch>
							</o:OfficeDocumentSettings>
						</xml>
						<![endif]-->
						<meta charset="UTF-8">
						<meta http-equiv="X-UA-Compatible" content="IE=edge">
						<meta name="viewport" content="width=device-width, initial-scale=1">
						<title>'.$empresa_sel.'</title>
						
							<style type="text/css">
						p{
							margin:10px 0;
							padding:0;
						}
						table{
							border-collapse:collapse;
						}
						h1,h2,h3,h4,h5,h6{
							display:block;
							margin:0;
							padding:0;
						}
						img,a img{
							border:0;
							height:auto;
							outline:none;
							text-decoration:none;
						}
						body,#bodyTable,#bodyCell{
							height:100%;
							margin:0;
							padding:0;
							width:100%;
						}
						#outlook a{
							padding:0;
						}
						img{
							-ms-interpolation-mode:bicubic;
						}
						table{
							mso-table-lspace:0pt;
							mso-table-rspace:0pt;
						}
						.ReadMsgBody{
							width:100%;
						}
						.ExternalClass{
							width:100%;
						}
						p,a,li,td,blockquote{
							mso-line-height-rule:exactly;
						}
						a[href^=tel],a[href^=sms]{
							color:inherit;
							cursor:default;
							text-decoration:none;
						}
						p,a,li,td,body,table,blockquote{
							-ms-text-size-adjust:100%;
							-webkit-text-size-adjust:100%;
						}
						.ExternalClass,.ExternalClass p,.ExternalClass td,.ExternalClass div,.ExternalClass span,.ExternalClass font{
							line-height:100%;
						}
						a[x-apple-data-detectors]{
							color:inherit !important;
							text-decoration:none !important;
							font-size:inherit !important;
							font-family:inherit !important;
							font-weight:inherit !important;
							line-height:inherit !important;
						}
						.templateContainer{
							max-width:600px !important;
						}
						a.mcnButton{
							display:block;
						}
						.mcnImage{
							vertical-align:bottom;
						}
						.mcnTextContent{
							word-break:break-word;
						}
						.mcnTextContent img{
							height:auto !important;
						}
						.mcnDividerBlock{
							table-layout:fixed !important;
						}
					/*
					@tab Page
					@section Heading 1
					@style heading 1
					*/
						h1{
							/*@editable*/color:#222222;
							/*@editable*/font-family:Helvetica;
							/*@editable*/font-size:40px;
							/*@editable*/font-style:normal;
							/*@editable*/font-weight:bold;
							/*@editable*/line-height:150%;
							/*@editable*/letter-spacing:normal;
							/*@editable*/text-align:center;
						}
					/*
					@tab Page
					@section Heading 2
					@style heading 2
					*/
						h2{
							/*@editable*/color:#222222;
							/*@editable*/font-family:Helvetica;
							/*@editable*/font-size:34px;
							/*@editable*/font-style:normal;
							/*@editable*/font-weight:bold;
							/*@editable*/line-height:88%;
							/*@editable*/letter-spacing:normal;
							/*@editable*/text-align:left;
						}
					/*
					@tab Page
					@section Heading 3
					@style heading 3
					*/
						h3{
							/*@editable*/color:#000000;
							/*@editable*/font-family:Helvetica;
							/*@editable*/font-size:22px;
							/*@editable*/font-style:normal;
							/*@editable*/font-weight:bold;
							/*@editable*/line-height:150%;
							/*@editable*/letter-spacing:normal;
							/*@editable*/text-align:center;
						}
					/*
					@tab Page
					@section Heading 4
					@style heading 4
					*/
						h4{
							/*@editable*/color:#999999;
							/*@editable*/font-family:Georgia;
							/*@editable*/font-size:20px;
							/*@editable*/font-style:italic;
							/*@editable*/font-weight:normal;
							/*@editable*/line-height:125%;
							/*@editable*/letter-spacing:normal;
							/*@editable*/text-align:left;
						}
					/*
					@tab Header
					@section Header Container Style
					*/
						#templateHeader{
							/*@editable*/ /* header */
							
							/*@editable*/background: #'.$cor_topo_sel.'; /* For browsers that do not support gradients */
							/*@editable*//*background: linear-gradient(to bottom right, #1a2980, #26d0cd); /* Standard syntax (must be last) */
							
							/*@editable*/background-repeat:no-repeat;
							/*@editable*/background-position:center;
							/*@editable*/background-size:cover;
							/*@editable*/border-top:0;
							/*@editable*/border-bottom:0;
							/*@editable*/padding-top:9px;
							/*@editable*/padding-bottom:9px;
						}
					/*
					@tab Header
					@section Header Interior Style
					*/
						.headerContainer{
							/*@editable*/background-color:transparent;
							/*@editable*/background-image:none;
							/*@editable*/background-repeat:no-repeat;
							/*@editable*/background-position:center;
							/*@editable*/background-size:cover;
							/*@editable*/border-top:0;
							/*@editable*/border-bottom:0;
							/*@editable*/padding-top:0;
							/*@editable*/padding-bottom:0;
						}
					/*
					@tab Header
					@section Header Text
					*/
						.headerContainer .mcnTextContent,.headerContainer .mcnTextContent p{
							/*@editable*/color:#000000;
							/*@editable*/font-family:Helvetica;
							/*@editable*/font-size:16px;
							/*@editable*/line-height:150%;
							/*@editable*/text-align:left;
						}
					/*
					@tab Header
					@section Header Link
					*/
						.headerContainer .mcnTextContent a,.headerContainer .mcnTextContent p a{
							/*@editable*/color:#00ADD8;
							/*@editable*/font-weight:normal;
							/*@editable*/text-decoration:underline;
						}
					/*
					@tab Body
					@section Body Container Style
					*/
						#templateBody{
							/*@editable*/background-color:#FFFFFF;
							/*@editable*/background-image:none;
							/*@editable*/background-repeat:no-repeat;
							/*@editable*/background-position:center;
							/*@editable*/background-size:cover;
							/*@editable*/border-top:0;
							/*@editable*/border-bottom:0;
							/*@editable*/padding-top:21px;
							/*@editable*/padding-bottom:21px;
						}
					/*
					@tab Body
					@section Body Interior Style
					*/
						.bodyContainer{
							/*@editable*/background-color:transparent;
							/*@editable*/background-image:none;
							/*@editable*/background-repeat:no-repeat;
							/*@editable*/background-position:center;
							/*@editable*/background-size:cover;
							/*@editable*/border-top:0;
							/*@editable*/border-bottom:0;
							/*@editable*/padding-top:0;
							/*@editable*/padding-bottom:0;
						}
					/*
					@tab Body
					@section Body Text
					*/
						.bodyContainer .mcnTextContent,.bodyContainer .mcnTextContent p{
							/*@editable*/color:#000000;
							/*@editable*/font-family:Helvetica;
							/*@editable*/font-size:16px;
							/*@editable*/line-height:150%;
							/*@editable*/text-align:left;
						}
					/*
					@tab Body
					@section Body Link
					*/
						.bodyContainer .mcnTextContent a,.bodyContainer .mcnTextContent p a{
							/*@editable*/color:#00ADD8;
							/*@editable*/font-weight:normal;
							/*@editable*/text-decoration:underline;
						}
					/*
					@tab Footer
					@section Footer Style
					*/
						#templateFooter{
							/*@editable*/ /* Rodapé */
							
							background: #'.$cor_rodape_sel.'; /* For browsers that do not support gradients */
							/* background: linear-gradient(to bottom right, #1a2980, #26d0cd); /* Standard syntax (must be last) */
							
							/*@editable*/background-repeat:no-repeat;
							/*@editable*/background-position:center;
							/*@editable*/background-size:cover;
							/*@editable*/border-top:0;
							/*@editable*/border-bottom:0;
							/*@editable*/padding-top:0px;
							/*@editable*/padding-bottom:0px;
						}
					/*
					@tab Footer
					@section Footer Interior Style
					*/
						.footerContainer{
							/*@editable*/background-color:transparent;
							/*@editable*/background-image:none;
							/*@editable*/background-repeat:no-repeat;
							/*@editable*/background-position:center;
							/*@editable*/background-size:cover;
							/*@editable*/border-top:0;
							/*@editable*/border-bottom:0;
							/*@editable*/padding-top:0;
							/*@editable*/padding-bottom:0;
						}
					/*
					@tab Footer
					@section Footer Text
					*/
						.footerContainer .mcnTextContent,.footerContainer .mcnTextContent p{
							/*@editable*/color:#FFFFFF;
							/*@editable*/font-family:Helvetica;
							/*@editable*/font-size:12px;
							/*@editable*/line-height:150%;
							/*@editable*/text-align:center;
						}
					/*
					@tab Footer
					@section Footer Link
					*/
						.footerContainer .mcnTextContent a,.footerContainer .mcnTextContent p a{
							/*@editable*/color:#FFFFFF;
							/*@editable*/font-weight:normal;
							/*@editable*/text-decoration:underline;
						}
					@media only screen and (min-width:768px){
						.templateContainer{
							width:600px !important;
						}

				}	@media only screen and (max-width: 480px){
						body,table,td,p,a,li,blockquote{
							-webkit-text-size-adjust:none !important;
						}

				}	@media only screen and (max-width: 480px){
						body{
							width:100% !important;
							min-width:100% !important;
						}

				}	@media only screen and (max-width: 480px){
						.mcnImage{
							width:100% !important;
						}

				}	@media only screen and (max-width: 480px){
						.mcnCartContainer,.mcnCaptionTopContent,.mcnRecContentContainer,.mcnCaptionBottomContent,.mcnTextContentContainer,.mcnBoxedTextContentContainer,.mcnImageGroupContentContainer,.mcnCaptionLeftTextContentContainer,.mcnCaptionRightTextContentContainer,.mcnCaptionLeftImageContentContainer,.mcnCaptionRightImageContentContainer,.mcnImageCardLeftTextContentContainer,.mcnImageCardRightTextContentContainer{
							max-width:100% !important;
							width:100% !important;
						}

				}	@media only screen and (max-width: 480px){
						.mcnBoxedTextContentContainer{
							min-width:100% !important;
						}

				}	@media only screen and (max-width: 480px){
						.mcnImageGroupContent{
							padding:9px !important;
						}

				}	@media only screen and (max-width: 480px){
						.mcnCaptionLeftContentOuter .mcnTextContent,.mcnCaptionRightContentOuter .mcnTextContent{
							padding-top:9px !important;
						}

				}	@media only screen and (max-width: 480px){
						.mcnImageCardTopImageContent,.mcnCaptionBlockInner .mcnCaptionTopContent:last-child .mcnTextContent{
							padding-top:18px !important;
						}

				}	@media only screen and (max-width: 480px){
						.mcnImageCardBottomImageContent{
							padding-bottom:9px !important;
						}

				}	@media only screen and (max-width: 480px){
						.mcnImageGroupBlockInner{
							padding-top:0 !important;
							padding-bottom:0 !important;
						}

				}	@media only screen and (max-width: 480px){
						.mcnImageGroupBlockOuter{
							padding-top:9px !important;
							padding-bottom:9px !important;
						}

				}	@media only screen and (max-width: 480px){
						.mcnTextContent,.mcnBoxedTextContentColumn{
							padding-right:18px !important;
							padding-left:18px !important;
						}

				}	@media only screen and (max-width: 480px){
						.mcnImageCardLeftImageContent,.mcnImageCardRightImageContent{
							padding-right:18px !important;
							padding-bottom:0 !important;
							padding-left:18px !important;
						}

				}	@media only screen and (max-width: 480px){
						.mcpreview-image-uploader{
							display:none !important;
							width:100% !important;
						}

				}	@media only screen and (max-width: 480px){
					/*
					@tab Mobile Styles
					@section Heading 1
					@tip Make the first-level headings larger in size for better readability on small screens.
					*/
						h1{
							/*@editable*/font-size:30px !important;
							/*@editable*/line-height:125% !important;
						}

				}	@media only screen and (max-width: 480px){
					/*
					@tab Mobile Styles
					@section Heading 2
					@tip Make the second-level headings larger in size for better readability on small screens.
					*/
						h2{
							/*@editable*/font-size:26px !important;
							/*@editable*/line-height:125% !important;
						}

				}	@media only screen and (max-width: 480px){
					/*
					@tab Mobile Styles
					@section Heading 3
					@tip Make the third-level headings larger in size for better readability on small screens.
					*/
						h3{
							/*@editable*/font-size:20px !important;
							/*@editable*/line-height:150% !important;
						}

				}	@media only screen and (max-width: 480px){
					/*
					@tab Mobile Styles
					@section Heading 4
					@tip Make the fourth-level headings larger in size for better readability on small screens.
					*/
						h4{
							/*@editable*/font-size:18px !important;
							/*@editable*/line-height:150% !important;
						}

				}	@media only screen and (max-width: 480px){
					/*
					@tab Mobile Styles
					@section Boxed Text
					@tip Make the boxed text larger in size for better readability on small screens. We recommend a font size of at least 16px.
					*/
						.mcnBoxedTextContentContainer .mcnTextContent,.mcnBoxedTextContentContainer .mcnTextContent p{
							/*@editable*/font-size:14px !important;
							/*@editable*/line-height:150% !important;
						}

				}	@media only screen and (max-width: 480px){
					/*
					@tab Mobile Styles
					@section Header Text
					@tip Make the header text larger in size for better readability on small screens.
					*/
						.headerContainer .mcnTextContent,.headerContainer .mcnTextContent p{
							/*@editable*/font-size:16px !important;
							/*@editable*/line-height:150% !important;
						}

				}	@media only screen and (max-width: 480px){
					/*
					@tab Mobile Styles
					@section Body Text
					@tip Make the body text larger in size for better readability on small screens. We recommend a font size of at least 16px.
					*/
						.bodyContainer .mcnTextContent,.bodyContainer .mcnTextContent p{
							/*@editable*/font-size:16px !important;
							/*@editable*/line-height:150% !important;
						}

				}	@media only screen and (max-width: 480px){
					/*
					@tab Mobile Styles
					@section Footer Text
					@tip Make the footer content text larger in size for better readability on small screens.
					*/
						.footerContainer .mcnTextContent,.footerContainer .mcnTextContent p{
							/*@editable*/font-size:14px !important;
							/*@editable*/line-height:150% !important;
						}

				}
							</style>
						</head>
					<body>
						<center>
							<table align="center" border="0" cellpadding="0" cellspacing="0" height="100%" width="100%" id="bodyTable">
								<tr>
									<td align="center" valign="top" id="bodyCell">
										<!-- BEGIN TEMPLATE // -->
										<table border="0" cellpadding="0" cellspacing="0" width="100%">
											<tr>
												<td style="background: #'.$cor_topo_sel.';" align="center" valign="top" id="templateHeader" data-template-container>
													<!--[if gte mso 9]>
													<table align="center" border="0" cellspacing="0" cellpadding="0" width="600" style="width:600px;">
													<tr>
													<td align="center" valign="top" width="600" style="width:600px;">
													<![endif]-->
													<table align="center" border="0" cellpadding="0" cellspacing="0" width="100%" class="templateContainer">
														<tr>
															<td valign="top" class="headerContainer"><table border="0" cellpadding="0" cellspacing="0" width="100%" class="mcnTextBlock" style="min-width:100%;">
					<tbody class="mcnTextBlockOuter">
						<tr>
							<td valign="top" class="mcnTextBlockInner" style="padding-top:9px;">
								<!--[if mso]>
								<table align="left" border="0" cellspacing="0" cellpadding="0" width="100%" style="width:100%;">
								<tr>
								<![endif]-->
								
								<!--[if mso]>
								<td valign="top" width="300" style="width:300px;">
								<![endif]-->
								<table align="left" border="0" cellpadding="0" cellspacing="0" style="max-width:300px;" width="100%" class="mcnTextContentContainer">
									<tbody><tr>
										
										<td valign="top" class="mcnTextContent" style="padding: 0px 18px 9px; line-height: 100%;">
										
											<h4 class="null"><img data-file-id="20865" height="39" src="'.$site_sel.'/images/email/'.$logo_sel.'" style="border: 0px; height: 39px; margin: 3% 0 0 0;" width="196"></h4>

										</td>
									</tr>
								</tbody></table>
								<!--[if mso]>
								</td>
								<![endif]-->
								
								<!--[if mso]>
								<td valign="top" width="300" style="width:300px;">
								<![endif]-->
								<table align="left" border="0" cellpadding="0" cellspacing="0" style="max-width:300px;" width="100%" class="mcnTextContentContainer">
									<tbody><tr>
										
										<td valign="top" class="mcnTextContent" style="padding: 16px 18px 9px; line-height: 100%;">
											<h2 class="mc-toc-title" style="text-align: left;"><span style="font-size:25px"><span style="color:#ffffff; text-transform: uppercase;"><strong>'.$titulo_sel.'</strong></span></span></h2>
										</td>
									</tr>
								</tbody></table>
								<!--[if mso]>
								</td>
								<![endif]-->
								
								<!--[if mso]>
								</tr>
								</table>
								<![endif]-->
							</td>
						</tr>
					</tbody>
				</table></td>
														</tr>
													</table>
													<!--[if gte mso 9]>
													</td>
													</tr>
													</table>
													<![endif]-->
												</td>
											</tr>
											<tr>
												<td align="center" valign="top" id="templateBody" data-template-container>
													<!--[if gte mso 9]>
													<table align="center" border="0" cellspacing="0" cellpadding="0" width="600" style="width:600px;">
													<tr>
													<td align="center" valign="top" width="600" style="width:600px;">
													<![endif]-->
													<table align="center" border="0" cellpadding="0" cellspacing="0" width="100%" class="templateContainer">
														<tr>
															<td valign="top" class="bodyContainer"><table border="0" cellpadding="0" cellspacing="0" width="100%" class="mcnTextBlock" style="min-width:100%;">

				</table><table border="0" cellpadding="0" cellspacing="0" width="100%" class="mcnDividerBlock" style="min-width:100%;">
					<tbody class="mcnDividerBlockOuter">
						<tr>
							<td class="mcnDividerBlockInner" style="min-width: 100%; padding: 18px 18px 0px;">
								<table class="mcnDividerContent" border="0" cellpadding="0" cellspacing="0" width="100%" style="min-width:100%;">
									<tbody><tr>
										<td>
											<span></span>
										</td>
									</tr>
								</tbody></table>
				<!--            
								<td class="mcnDividerBlockInner" style="padding: 18px;">
								<hr class="mcnDividerContent" style="border-bottom-color:none; border-left-color:none; border-right-color:none; border-bottom-width:0; border-left-width:0; border-right-width:0; margin-top:0; margin-right:0; margin-bottom:0; margin-left:0;" />
				-->
							</td>
						</tr>
					</tbody>
				</table><table border="0" cellpadding="0" cellspacing="0" width="100%" class="mcnTextBlock" style="min-width:100%;">
					<tbody class="mcnTextBlockOuter">
						<tr>
							<td valign="top" class="mcnTextBlockInner" style="padding-top:9px;">
								<!--[if mso]>
								<table align="left" border="0" cellspacing="0" cellpadding="0" width="100%" style="width:100%;">
								<tr>
								<![endif]-->
								
								<!--[if mso]>
								<td valign="top" width="600" style="width:600px;">
								<![endif]-->
								<table align="left" border="0" cellpadding="0" cellspacing="0" style="max-width:100%; min-width:100%;" width="100%" class="mcnTextContentContainer">
									<tbody>
										<tr>
											<td valign="top" class="mcnTextContent" style="padding-top:0; padding-right:18px; padding-bottom:9px; padding-left:18px; text-align: center; color: #FFFFFF;">
											<p>
												<span style="font-size:18px">
													<i>Enviado por</i>:<br /><br />
													Nome: '.$nome.'<br />
													E-mail: '.$email.'<br />
													Telefone: '.$telefone.'<br />
													<u>Mensagem</u>: '.$mensagem.'<br /><br />
													Enviado em: '.$data.', às '.$hora.'	
												</span>
												<br /><br />
												&nbsp;
											</p>
										</td>
									</tr>
								</tbody></table>
								<!--[if mso]>
								</td>
								<![endif]-->
								
								<!--[if mso]>
								</tr>
								</table>
								<![endif]-->
							</td>
						</tr>
					</tbody>
				</table><table border="0" cellpadding="0" cellspacing="0" width="100%" class="mcnDividerBlock" style="min-width:100%;">
					<tbody class="mcnDividerBlockOuter">
						<tr>
							<td class="mcnDividerBlockInner" style="min-width: 100%; padding: 9px 18px 0px;">
								<table class="mcnDividerContent" border="0" cellpadding="0" cellspacing="0" width="100%" style="min-width:100%;">
									<tbody><tr>
										<td>
											<span></span>
										</td>
									</tr>
								</tbody></table>
				<!--            
								<td class="mcnDividerBlockInner" style="padding: 18px;">
								<hr class="mcnDividerContent" style="border-bottom-color:none; border-left-color:none; border-right-color:none; border-bottom-width:0; border-left-width:0; border-right-width:0; margin-top:0; margin-right:0; margin-bottom:0; margin-left:0;" />
				-->
							</td>
						</tr>
					</tbody>
				</table><table border="0" cellpadding="0" cellspacing="0" width="100%" class="mcnDividerBlock" style="min-width:100%;">
					<tbody class="mcnDividerBlockOuter">
						<tr>
							<td class="mcnDividerBlockInner" style="min-width: 100%; padding: 18px 18px 0px;">
								<table class="mcnDividerContent" border="0" cellpadding="0" cellspacing="0" width="100%" style="min-width:100%;">
									<tbody><tr>
										<td>
											<span></span>
										</td>
									</tr>
								</tbody></table>
				<!--            
								<td class="mcnDividerBlockInner" style="padding: 18px;">
								<hr class="mcnDividerContent" style="border-bottom-color:none; border-left-color:none; border-right-color:none; border-bottom-width:0; border-left-width:0; border-right-width:0; margin-top:0; margin-right:0; margin-bottom:0; margin-left:0;" />
				-->
							</td>
						</tr>
					</tbody>
				</table><table border="0" cellpadding="0" cellspacing="0" width="100%" class="mcnBoxedTextBlock" style="min-width:100%;">
					<!--[if gte mso 9]>
					<table align="center" border="0" cellspacing="0" cellpadding="0" width="100%">
					<![endif]-->
					<tbody class="mcnBoxedTextBlockOuter">
						<tr>
							<td valign="top" class="mcnBoxedTextBlockInner">
								
								<!--[if gte mso 9]>
								<td align="center" valign="top" ">
								<![endif]-->
								<table align="left" border="0" cellpadding="0" cellspacing="0" width="100%" style="min-width:100%;" class="mcnBoxedTextContentContainer">
									<tbody>
										<tr>
											<td style="padding-top:9px; padding-left:18px; padding-bottom:9px; padding-right:18px;">
												<table border="0" cellpadding="18" cellspacing="0" class="mcnTextContentContainer" width="100%" style="min-width: 100% !important;background-color: #F7F7F7;">
													<tbody>
														<tr>
															<td valign="top" class="mcnTextContent" style="color: #000000;font-family: Helvetica;font-size: 16px;line-height: 200%;text-align: center;">
																<h3 style="text-align: left;">'.$empresa_sel.'</h3>
															</td>
														</tr>
													</tbody>
												</table>
											</td>
										</tr>
									</tbody>
								</table>
								<!--[if gte mso 9]>
								</td>
								<![endif]-->
								
								<!--[if gte mso 9]>
								</tr>
								</table>
								<![endif]-->
							</td>
						</tr>
					</tbody>
				</table></td>
														</tr>
													</table>
													<!--[if gte mso 9]>
													</td>
													</tr>
													</table>
													<![endif]-->
												</td>
											</tr>
											<tr>
												<td style="background: #'.$cor_rodape_sel.';" align="center" valign="top" id="templateFooter" data-template-container>
													<!--[if gte mso 9]>
													<table align="center" border="0" cellspacing="0" cellpadding="0" width="600" style="width:600px;">
													<tr>
													<td align="center" valign="top" width="600" style="width:600px;">
													<![endif]-->
													<table align="center" border="0" cellpadding="0" cellspacing="0" width="100%" class="templateContainer">
														<tr>
															<td valign="top" class="footerContainer"><table border="0" cellpadding="0" cellspacing="0" width="100%" class="mcnFollowBlock" style="min-width:100%;">
					<tbody class="mcnFollowBlockOuter">
						<tr>
							<td align="center" valign="top" style="padding:9px" class="mcnFollowBlockInner">
								<!--[if gte mso 9]>
								<td align="center" valign="top" ">
								<![endif]-->
								<table align="left" border="0" cellpadding="0" cellspacing="0" width="100%" style="min-width:100%;" class="mcnBoxedTextContentContainer">
									<tbody>
										<tr>
											<td style="padding-top:9px; padding-left:18px; padding-bottom:9px; padding-right:18px;">
												<table border="0" cellpadding="18" cellspacing="0" class="mcnTextContentContainer" width="100%" style="min-width: 100% !important;">
													<tbody>
														<tr>
															<td valign="top" class="mcnTextContent" style="color: #FFFFFF;font-family: Helvetica;font-size: 20px;line-height: 200%;text-align: center;">
																<a href="'.$site_sel.'" style="text-decoration: none;"><h3 style="color: #FFFFFF; ">'.$site_link.'</h3></a>
															</td>
														</tr>
													</tbody>
												</table>
											</td>
										</tr>
									</tbody>
								</table>
								<!--[if gte mso 9]>
								</td>
								<![endif]-->			
							
								<table border="0" cellpadding="0" cellspacing="0" width="100%" class="mcnFollowContentContainer" style="min-width:100%;">
					<tbody><tr>
						<td align="center" style="padding-left:9px;padding-right:9px;">
							<table border="0" cellpadding="0" cellspacing="0" class="mcnFollowContent">
								<tbody><tr>
									<td align="center" valign="top" style="padding-top:9px; padding-right:9px; padding-left:9px;">
										<table align="center" border="0" cellpadding="0" cellspacing="0">
											<tbody><tr>
												<td align="center" valign="top">
													<!--[if mso]>
													<table align="center" border="0" cellspacing="0" cellpadding="0">
													<tr>
													<![endif]-->
														';
														if(!empty($rede_social_1_sel)){
														$mail->Body     .=
														'	
														<!--[if mso]>
														<td align="center" valign="top">
														<![endif]-->
															<table align="left" border="0" cellpadding="0" cellspacing="0" class="mcnFollowStacked" style="display:inline;">
																<tbody>
																	<tr>
																		<td align="center" valign="top" class="mcnFollowIconContent" style="padding-right:10px; padding-bottom:9px;">
																			<a href="'.$rede_social_1_sel.'" target="_blank"><img src="'.$site_sel.'/images/email/facebook.png" alt="Facebook" class="mcnFollowBlockIcon" width="48" style="width:48px; max-width:48px; display:block;"></a>
																		</td>
																	</tr>
																</tbody>
															</table>
														
														<!--[if mso]>
														</td>
														<![endif]-->
														';
														}
														
														if(!empty($rede_social_2_sel)){
														$mail->Body     .=
														'
														<!--[if mso]>
														<td align="center" valign="top">
														<![endif]-->
															<table align="left" border="0" cellpadding="0" cellspacing="0" class="mcnFollowStacked" style="display:inline;">
																<tbody>
																	<tr>
																		<td align="center" valign="top" class="mcnFollowIconContent" style="padding-right:10px; padding-bottom:9px;">
																			<a href="'.$rede_social_2_sel.'" target="_blank"><img src="'.$site_sel.'/images/email/instagram.png" alt="Instagram" class="mcnFollowBlockIcon" width="48" style="width:48px; max-width:48px; display:block;"></a>
																		</td>
																	</tr>
																</tbody>
															</table>
														<!--[if mso]>
														</td>
														<![endif]-->
														';
														}
																
														if(!empty($rede_social_3_sel)){
														$mail->Body     .=	
														'
														<!--[if mso]>
														<td align="center" valign="top">
														<![endif]-->
															<table align="left" border="0" cellpadding="0" cellspacing="0" class="mcnFollowStacked" style="display:inline;">
																<tbody>
																	<tr>
																		<td align="center" valign="top" class="mcnFollowIconContent" style="padding-right:10px; padding-bottom:9px;">
																			<a href="'.$rede_social_3_sel.'" target="_blank"><img src="'.$site_sel.'/images/email/linkedin.png" alt="Linkedin" class="mcnFollowBlockIcon" width="48" style="width:48px; max-width:48px; display:block;"></a>
																		</td>
																	</tr>
																</tbody>
															</table>
														<!--[if mso]>
														</td>
														<![endif]-->	
														';
														}
														
														if(!empty($rede_social_4_sel)){
														$mail->Body     .=	
														'
														<!--[if mso]>
														<td align="center" valign="top">
														<![endif]-->
															<table align="left" border="0" cellpadding="0" cellspacing="0" class="mcnFollowStacked" style="display:inline;">
																<tbody>
																	<tr>
																		<td align="center" valign="top" class="mcnFollowIconContent" style="padding-right:10px; padding-bottom:9px;">
																			<a href="'.$rede_social_4_sel.'" target="_blank"><img src="'.$site_sel.'/images/email/twitter.png" alt="Twitter" class="mcnFollowBlockIcon" width="48" style="width:48px; max-width:48px; display:block;"></a>
																		</td>
																	</tr>
																</tbody>
															</table>
														<!--[if mso]>
														</td>
														<![endif]-->
														';
														}
														
														if(!empty($rede_social_5_sel)){
														'
														$mail->Body     .=
														<!--[if mso]>
														<td align="center" valign="top">
														<![endif]-->
															<table align="left" border="0" cellpadding="0" cellspacing="0" class="mcnFollowStacked" style="display:inline;">
																<tbody>
																	<tr>
																		<td align="center" valign="top" class="mcnFollowIconContent" style="padding-right:10px; padding-bottom:9px;">
																			<a href="'.$rede_social_5_sel.'" target="_blank"><img src="'.$site_sel.'/images/email/google-plus.png" alt="Google Plus" class="mcnFollowBlockIcon" width="48" style="width:48px; max-width:48px; display:block;"></a>
																		</td>
																	</tr>
																</tbody>
															</table>
														<!--[if mso]>
														</td>
														<![endif]-->	
														';
														}
														
														if(!empty($rede_social_6_sel)){
														$mail->Body     .=	
														'
														<!--[if mso]>
														<td align="center" valign="top">
														<![endif]-->
															<table align="left" border="0" cellpadding="0" cellspacing="0" class="mcnFollowStacked" style="display:inline;">
																<tbody>
																	<tr>
																		<td align="center" valign="top" class="mcnFollowIconContent" style="padding-right:10px; padding-bottom:9px;">
																			<a href="'.$rede_social_6_sel.'" target="_blank"><img src="'.$site_sel.'/images/email/youtube.png" alt="Youtube" class="mcnFollowBlockIcon" width="48" style="width:48px; max-width:48px; display:block;"></a>
																		</td>
																	</tr>
																</tbody>
															</table>
														<!--[if mso]>
														</td>
														<![endif]-->
														';
														}
														$mail->Body     .=
														'
												</td>
											</tr>
										</tbody></table>
									</td>
								</tr>
							</tbody></table>
						</td>
					</tr>
				</tbody></table>

							</td>
						</tr>
					</tbody>
				</table><table border="0" cellpadding="0" cellspacing="0" width="100%" class="mcnDividerBlock" style="min-width:100%;">
					<tbody class="mcnDividerBlockOuter">
						<tr>
							<td class="mcnDividerBlockInner" style="min-width:100%; padding:18px;">
								<table class="mcnDividerContent" border="0" cellpadding="0" cellspacing="0" width="100%" style="min-width: 100%;border-top: 2px solid #FFFFFF;">
									<tbody><tr>
										<td>
											<span></span>
										</td>
									</tr>
								</tbody></table>
				<!--            
								<td class="mcnDividerBlockInner" style="padding: 18px;">
								<hr class="mcnDividerContent" style="border-bottom-color:none; border-left-color:none; border-right-color:none; border-bottom-width:0; border-left-width:0; border-right-width:0; margin-top:0; margin-right:0; margin-bottom:0; margin-left:0;" />
				-->
							</td>
						</tr>
					</tbody>
				</table><table border="0" cellpadding="0" cellspacing="0" width="100%" class="mcnTextBlock" style="min-width:100%;">
					<tbody class="mcnTextBlockOuter">
						<tr>
							<td valign="top" class="mcnTextBlockInner" style="padding-top:9px;">
								<!--[if mso]>
								<table align="left" border="0" cellspacing="0" cellpadding="0" width="100%" style="width:100%;">
								<tr>
								<![endif]-->
								
								<!--[if mso]>
								<td valign="top" width="600" style="width:600px;">
								<![endif]-->
								<table align="left" border="0" cellpadding="0" cellspacing="0" style="max-width:100%; min-width:100%;" width="100%" class="mcnTextContentContainer">
									<tbody><tr>
										
										<td valign="top" class="mcnTextContent" style="padding-top:0; padding-right:18px; padding-bottom:9px; padding-left:18px; text-align: center; color: #FFFFFF;">
											<em>
												';
												if(!empty($cep_sel)){
													if(!empty($complemento_sel)){
														$mail->Body     .=	
														'  									
														'.$endereco_sel . " | " .  $numero_sel . " | " . $complemento_sel . " | " . $bairro_sel . " | " . $cidade_sel . " | " . $estado_sel.'
													';
													}else{
														$mail->Body     .=	
														'									
														'.$endereco_sel . " | " .  $numero_sel . " | " . $bairro_sel . " | " . $cidade_sel . " | " . $estado_sel.'
														';
													}
												}
												$mail->Body     .=
												'
												<br /> 
												';
												$sql_tel_emp = mysqli_query($config, "SELECT telefone FROM tb_email_home_telefone WHERE id_item = '1'") or die(mysqli_error($config));
													
												if(@mysqli_num_rows($sql_tel_emp) <= '0'){
													echo "";
												}else{
													$y_info = 1;
													$allRows_info = mysqli_num_rows($sql_tel_emp);
													while($r_sql_tel_emp = mysqli_fetch_array($sql_tel_emp)){
														if($allRows_info == 1){
															$mail->Body     .=	
															'
															'.$telefone_email_home_sel = $r_sql_tel_emp[0].'
															';											
														}else{
															if ($allRows_info == $y_info) {
																$x_info = 1;
															} else {
																$x_info = 2;
															}
															$y_info++;
																if ($y_info == 2) {
																$mail->Body     .=	
																'
																'.$telefone_email_home_sel = $r_sql_tel_emp[0] . " | ".'
																';
															}else{
																$mail->Body     .=	
																'
																'.$telefone_email_home_sel = $r_sql_tel_emp[0].'
																';
															}											
														}	
													}
												}
												$mail->Body     .=
												'
											</em>
										</td>
									</tr>
								</tbody></table>
								<!--[if mso]>
								</td>
								<![endif]-->
								
								<!--[if mso]>
								</tr>
								</table>
								<![endif]-->
							</td>
						</tr>
					</tbody>
				</table></td>
														</tr>
													</table>
													<!--[if gte mso 9]>
													</td>
													</tr>
													</table>
													<![endif]-->
												</td>
											</tr>
										</table>
										<!-- // END TEMPLATE -->
									</td>
								</tr>
							</table>
						</center>
					</body>
				</html>																
																		';
																		
		//return $resultado;
	}
	
	echo corpo_email(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);
?>

 

Compartilhar este post


Link para o post
Compartilhar em outros sites

  • Conteúdo Similar

    • Por Rafael_Ferreira
      Não consigo carregar a imagem do captcha do meu formulário. Foi testado com o xampp e easyphp. Também não carregou a imagem de outros captcha. 
       
       
    • Por luiz monteiro
      Olá, tudo bem?
       
      Estou melhorando meu conhecimento em php e mysql e, me deparei com o seguinte. A tabela da base de dados tem um campo do tipo varchar(8) o qual armazena números. Eu não posso alterar o tipo desse campo. O que preciso é fazer um select para retornar o números que contenham zeros a direita ou a esquerda.
      O que tentei até agora
       
      Ex1
      $busca = $conexao->prepare("select campo form tabela where (campo = :campo) ");
      $busca->bindParam('campo', $_REQUEST['campo_form']);
       
      Se a direita da string $_REQUEST['campo_form'] termina ou inicia com zero ou zeros, a busca retorna vazio.
      Inseri dados numéricos, da seguinte maneira para testar: 01234567;  12345670: 12345678: 12340000... entre outros nessa coluna. Todos os valores que não terminam ou não iniciam com zero ou zeros, o select funciona.
       
       
      Ex2
      $busca = $conexao->prepare("select campo form tabela where (campo = 0340000) ");
      Esse número está cadastrado, mas não retorna.
       
      Ex3
      $busca = $conexao->prepare("select campo form tabela where (campo = '02340001' ) ");
      Esse número está cadastrado, mas não retorna.
       
       
      Ex4
      $busca = $conexao->prepare("select campo form tabela where (campo like 2340000) ");
      Esse número está cadastrado, mas não retorna.
       
      Ex5
      $busca = $conexao->prepare("select campo form tabela where (campo like '12340000') ");
      Esse número está cadastrado, mas não retorna.
       
      Ex6
      $busca = $conexao->prepare("select campo form tabela where (campo like '"12340000"' ) ");
      Esse número está cadastrado, mas não retorna.
       
       
      Ex7
      $busca = $conexao->prepare("select campo form tabela where (campo like :campo) ");
      $busca->bindParam('campo', $_REQUEST['campo_form'])
      Não retorna dados.
       
      O  $_REQUEST['campo_form'] é envio via AJAX de um formulário. 
      Usei o gettype para verificar o post, e ele retorna string.
      Fiz uma busca com número 12345678 para verificar o que o select retorna, e também retrona como string.
       
      Esse tipo de varchar foi usado porque os números que serão gravados nesse campo,  terão zeros a direita ou na esquerda. Os tipos number do mysql não gravam zeros, então estou usando esse. O problema é a busca.
      Agradeço desde já.
       
       
    • Por daemon
      Boa tarde,
       
      Eu tenho uma rotina que faz uma leitura do arquivo .xml de vários sites.

      Eu consigo pegar o tópico e a descrição, e mostrar a imagem que esta na pagina do link.
      Para isso utilizo esta função:
      function getPreviewImage($url) { // Obter o conteúdo da página $html = file_get_contents($url); // Criar um novo objeto DOMDocument $doc = new DOMDocument(); @$doc->loadHTML($html); // Procurar pela tag meta og:image $tags = $doc->getElementsByTagName('meta'); foreach ($tags as $tag) { if ($tag->getAttribute('property') == 'og:image') { return $tag->getAttribute('content'); } } // Se não encontrar og:image, procurar pela primeira imagem na página $tags = $doc->getElementsByTagName('img'); if ($tags->length > 0) { return $tags->item(0)->getAttribute('src'); } // Se não encontrar nenhuma imagem, retornar null return null; } // Uso: $url = "https://example.com/article"; $imageUrl = getPreviewImage($url); if ($imageUrl) { echo "<img src='$imageUrl' alt='Preview'>"; } else { echo "Nenhuma imagem encontrada"; }  
      Mas estou com um problema, esta funcão funciona quando coloco em uma pagina de teste.php. Preciso mostrar em uma página inicial diversas fotos de todos os links. (No caso acima só funciona 1).
    • Por violin101
      Caros amigos, saudações.
       
      Por favor, me permita tirar uma dúvida com os amigos.

      Tenho um Formulário onde o Usuário digita todos os Dados necessários.

      Minha dúvida:
      --> como faço após o usuário digitar os dados e salvar, o Sistema chamar uma Modal ou mensagem perguntando se deseja imprimir agora ?

      Grato,
       
      Cesar
    • Por Carcleo
      Tenho uma abela de usuarios e uma tabela de administradores e clientes.
      Gostaria de uma ajuda para implementar um cadastro
       
      users -> name, login, passord (pronta) admins -> user_id, registratiom, etc.. client -> user_id, registratiom, etc...
      Queria ajuda para extender de user as classes Admin e Client
      Olhem como estáAdmin
      <?php namespace App\Models; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; class Admin extends User {     use HasFactory;            protected $fillable = [         'name',         'email',         'password',         'registration'     ];      private string $registration;     public function create(         string $name,          string $email,          string $password,         string $registration     )     {         //parent::create(['name'=>$name, 'email'=>$email, 'password'=>$password]);         parent::$name = $name;         parent::$email = $email;         parent::$password = $password;         $this->registration = $registration;     } } User
      <?php namespace App\Models; // use Illuminate\Contracts\Auth\MustVerifyEmail; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Notifications\Notifiable; use Illuminate\Database\Eloquent\Relations\BelongsToMany; class User extends Authenticatable {     /** @use HasFactory<\Database\Factories\UserFactory> */     use HasFactory, Notifiable;     static string $name;     static string $email;     static string $password;     /**      * The attributes that are mass assignable.      *      * @var list<string>      */     protected $fillable = [         'name',         'email',         'password',     ];          /**      * The attributes that should be hidden for serialization.      *      * @var list<string>      */     protected $hidden = [         'remember_token',     ];     /**      * Get the attributes that should be cast.      *      * @return array<string, string>      */     protected function casts(): array     {         return [             'email_verified_at' => 'datetime',             'password' => 'hashed',         ];     }          public function roles() : BelongsToMany {         return $this->belongsToMany(Role::class);     }       public function hasHole(Array $roleName): bool     {                 foreach ($this->roles as $role) {             if ($role->name === $roleName) {                 return true;             }         }         return false;     }         public function hasHoles(Array $rolesName): bool     {                 foreach ($this->roles as $role) {             foreach ($rolesName as $rolee) {             if ($role->name === $rolee) {                 return true;             }          }         }         return false;     }         public function hasAbility(string $ability): bool     {         foreach ($this->roles as $role) {             if ($role->abilities->contains('name', $ability)) {                 return true;             }         }         return false;     }     } Como gravar um Admin na tabela admins sendo que ele é um User por extensão?
      Tentei assim mas é claro que está errado...
      public function store(Request $request, Admin $adminModel) {         $dados = $request->validate([             "name" => "required",             "email" => "required|email",             "password" => "required",             "registration" => "required"         ]);         $dados["password"] =  Hash::make($dados["password"]);                  $admin = Admin::where("registration",  $dados["registration"])->first();                  if ($admin)              return                    redirect()->route("admin.new")                             ->withErrors([                                 'fail' => 'Administrador já cadastrados<br>, favor verificar!'                   ]);                            $newAdmin = $adminModel->create(                                    $dados['name'],                                    $dados['email'],                                    $dados['password'],                                    $dados['registration']                                 );         dd($newAdmin);         $adminModel->save();         //$adminModel::create($admin);                  return redirect()->route("admin.new")->with("success",'Cadastrado com sucesso');     }  
×

Informação importante

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