Answers for "phpmailer html email"

PHP
1

core php mail function without phpmailer

<?php
ini_set('display_errors',1);
ini_set('display_startup_errors',1);
error_reporting(-1);

session_start();

$to = '[email protected]';
$subject = 'Subject xxxxx xxxxxx';

$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=charset=utf-8\r\n";
$headers .= "From: " . $_POST['email'] . "\r\n";
//$headers .= "Reply-To: ". $_POST['email'] . "\r\n";
$headers .= "CC: [email protected]\r\n";



$message = "<html><body>";

$message .= '<table style="border-color: #666; background: #eee; cellpadding="10">';
$message .= "<tr><td><strong>Name:</strong> </td><td>" . $_POST['username'] . "</td></tr>";
$message .= "<tr><td><strong>Email:</strong> </td><td>" . $_POST['email'] . "</td></tr>"; 


$message .= "</table>";
$message .= "</body></html>";


echo $message;
//echo $headers;



$response=mail($to, $subject, $message, $headers);

if($response==1)
{
echo "<script language='javascript' type='text/javascript'>
        
       window.location = 'index.html';
    </script>";

}
else{
echo 
"<script language='javascript' type='text/javascript'>
        alert('mail send failed');
    </script>";
}



?>
Posted by: Guest on August-27-2020
1

phpmailer example php

<?php

require_once('class.phpmailer.php');

$mailer = new PHPMailer();
$mailer->IsSMTP();
$mailer->SMTPDebug = 1;
$mailer->Port = 587; //Indica a porta de conexão 
$mailer->Host = 'smtplw.com.br';//Endereço do Host do SMTP 
$mailer->SMTPAuth = true; //define se haverá ou não autenticação 
$mailer->Username = 'smtplocaweb'; //Login de autenticação do SMTP
$mailer->Password = 'Gwb9etA323'; //Senha de autenticação do SMTP
$mailer->FromName = 'Bart S. Locaweb'; //Nome que será exibido
$mailer->From = '[email protected]'; //Obrigatório ser 
a mesma caixa postal configurada no remetente do SMTP
$mailer->AddAddress('[email protected]','Nome do 
destinatário');
//Destinatários
$mailer->Subject = 'Teste enviado através do PHP Mailer 
SMTPLW';
$mailer->Body = 'Este é um teste realizado com o PHP Mailer 
SMTPLW';
if(!$mailer->Send())
{
echo "Message was not sent";
echo "Mailer Error: " . $mailer->ErrorInfo; exit; }
print "E-mail enviado!"
?>
Posted by: Guest on May-11-2020
0

html php email

$mailtext = '<html>
<head>
    <title>HTML-E-Mail mit PHP erstellen</title>
</head>

<body>
...
</body>
</html>
';

$empfaenger = "[email protected]";  // Mailadresse
$absender   = "[email protected]";
$betreff    = "Mail-Test - HTML-E-Mail mit PHP erstellen";
$antwortan  = "[email protected]";

$header  = "MIME-Version: 1.0\r\n";
$header .= "Content-type: text/html; charset=utf-8\r\n";

$header .= "From: $absender\r\n";
$header .= "Reply-To: $antwortan\r\n";
// $header .= "Cc: $cc\r\n";  // falls an CC gesendet werden soll
$header .= "X-Mailer: PHP ". phpversion();

mail( $empfaenger,
      $betreff,
      $mailtext,
      $header);

echo "Mail wurde gesendet!";
Posted by: Guest on October-24-2020
1

php mail example

$message = '
<html>
<head>
  <title>Review Request Reminder</title>
</head>
<body>
  <p>Here are the cases requiring your review in December:</p>
  <table>
    <tr>
      <th>Case title</th><th>Category</th><th>Status</th><th>Due date</th>
    </tr>
    <tr>
      <td>Case 1</td><td>Development</td><td>pending</td><td>Dec-20</td>
    </tr>
    <tr>
      <td>Case 1</td><td>DevOps</td><td>pending</td><td>Dec-21</td>
    </tr>
  </table>
</body>
</html>
';
Posted by: Guest on October-22-2020
0

PHP Email Form

<form enctype="multipart/form-data" method="POST" action="">
    <label>Your Name <input type="text" name="sender_name" /> </label> 
    <label>Your Email <input type="email" name="sender_email" /> </label> 
    <label>Subject <input type="text" name="subject" /> </label> 
    <label>Message <textarea name="message"></textarea> </label> 
    <label>Attachment <input type="file" name="attachment" /></label>
    <label><input type="submit" name="button" value="Submit" /></label>
</form>
Posted by: Guest on June-04-2021

Browse Popular Code Answers by Language