Natasha
Natasha

Reputation: 980

issue while sending mail using php mailer

I have send an email using php mailer class. mail was sending successfully but I got the mail content as 'logo 1'. am using the following code.. anybody please help

<?
include_once 'editors/tinymce.php';
$to = '[email protected]';
$frm = '[email protected]';
$sub = 'Weekly Working Report';

$mail_body = include_once('mail_content.php');
$mailstatus = l_mail('', '', $to, '', $frm, '', $sub, $mail_body);

if ($mailstatus == 'ok') {
    echo '<center><font color=red style="font-size:14px">Message has been sent Succesfully.....!</font></center><br>';
} else {
    echo $mailstatus;
}
?>

Upvotes: 0

Views: 383

Answers (3)

safrazik
safrazik

Reputation: 1601

you shouldn't write as $mail_body = include_once('mail_content.php'); instead,

include_once 'editors/tinymce.php';
$to = '[email protected]';
$frm = '[email protected]';
$sub = 'Weekly Working Report';

    ob_start(); // start output buffering
    include_once('mail_content.php');
    $mail_body = ob_get_contents(); // get the contents from the buffer
    ob_end_clean();

$mailstatus = l_mail('', '', $to, '', $frm, '', $sub, $mail_body);

if ($mailstatus == 'ok') {
    echo '<center><font color=red style="font-size:14px">Message has been sent Succesfully.....!</font></center><br>';
} else {
    echo $mailstatus;
}

Upvotes: 2

Saiyam Patel
Saiyam Patel

Reputation: 1161

use the below code when you create object of the phpmailer class

$mail = new phpmailer();
$mail->IsHTML(true);

thanks

Upvotes: 0

krishna
krishna

Reputation: 950

$to = "[email protected]";
 $subject = "Hey keep belief in me!";
 $body = "Hi,\n\nHow are you?\n\n be good do good";
 $header="[email protected]";
 if (mail($to, $subject, $body, $header)) {
   echo("<p>Message successfully sent!</p>");
  } else {
   echo("<p>Message delivery failed...</p>");
  }

I hope this works

Upvotes: 0

Related Questions