Separate email body from within php tag

Asked

Viewed 81 times

0

I want to separate the simple quotes from the PHP tag:

I have a code that sends an email to clients. I’ll just put here the part of the code where I want to separate the simple quotes that is this one original: $mail->Body = 'aqui';

What I’m wanting and more or less this down more not working out someone there to give a hang?

<?php $mail->Body = "'";?>

aqui

<?php"'";?>

complete code

<?php

// Inclui o arquivo class.phpmailer.php localizado na mesma pasta do arquivo php
include "PHPMailer-master/PHPMailerAutoload.php";



// Inicia a classe PHPMailer
$mail = new PHPMailer();

// Método de envio
$mail->IsSMTP(); // Enviar por SMTP 
$mail->Host = "mail.servidor.com.br"; // Você pode alterar este parametro para o endereço de SMTP do seu provedor
$mail->Port = 25; 

$mail->SMTPAuth = false; // Usar autenticação SMTP (obrigatório)
$mail->Username = '[email protected]'; // Usuário do servidor SMTP (endereço de email)
//$mail->Password = 'XXXXX'; // Mesma senha da sua conta de email

// Configurações de compatibilidade para autenticação em TLS
$mail->SMTPOptions = array(
 'ssl' => array(
 'verify_peer' => false,
 'verify_peer_name' => false,
 'allow_self_signed' => true
 )
);
// $mail->SMTPDebug = 2; // Você pode habilitar esta opção caso tenha problemas. Assim pode identificar mensagens de erro.

// Define o remetente
$mail->From = $_REQUEST['email']; // Seu e-mail
$mail->FromName = $_REQUEST['Nome']; // Seu nome

// Define o(s) destinatário(s)
$mail->AddAddress('[email protected]', 'Terminal Ajato');
//$mail->AddAddress('[email protected]');


// CC
//$mail->AddCC('[email protected]', ''); 

// BCC - Cópia oculta
//$mail->AddBCC('[email protected]', 'Roberto'); 

// Definir se o e-mail é em formato HTML ou texto plano
$mail->IsHTML(true); // Formato HTML . Use "false" para enviar em formato texto simples.

$mail->CharSet = 'UTF-8'; // Charset (opcional)

// Assunto da mensagem
$mail->Subject = $_REQUEST['Nome']; 

// Corpo do email
$mail->Body = 'aqui';


// Anexos (opcional)
//$mail->AddAttachment("/home/usuario/public_html/documento.pdf", "documento.pdf"); 

// Envia o e-mail
$enviado = $mail->Send();


// Exibe uma mensagem de resultado


?>
  • Very confusing your question. What exactly do you want to do?

  • Anderson my friend and the following I want to make a table in the Dreamweaver on the body part of the email and I am not able to do I will put the full code below can be ? for you to understand better !

  • If I understand correctly, what you need is Heredoc or Nowdoc. Read on. And please snippet is for HTML/JS/CSS code, do not use it for PHP.

  • Blz Thank you my friend !

1 answer

0


I don’t quite understand your question, but I believe that what you want to do is put an html code in the variable that corresponds to the body of the email.

For this you can do the following:

<?php $mail->Body = "<p>Primeiro paragrafo</p>";?>

You can put any tag it will be interpreted, if you need to put double quotes inside the text use the before quotes.

For example:

<?php $mail->Body = "<p>Primeiro paragrafo. \" isso é apenas um teste \"</p>";?>
  • You’ll understand me now! inside those double quotes where you put paragraph and the message need to put other php code with the <?php tag ;?>

  • I know this is wrong with if it were like this: <?php $mail->Body = "<? php echo$ data ?>";?>

  • You can concatenate what you need. This way: $var = 112; $test = "<p>Test</p>". $var." Test";

  • Do you want to send a script in the email? What exactly do you want to do by opening another php tag?

  • Anderson only one more doubt would be possible otherwise it is not to concatenate I am with the code here of the table everything ready here to be inserted

  • @Maxrogério

  • But it has the intention that this sent script is run to the client to open the email?

  • it is not because I am taking data from another variable and the code is ready I do not want to concatenate

  • If the data you need is in a variable, you can put the text you want normally and concatenate with this variable that will be interpreted as well

Show 4 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.