Welcome Guest, Not a member yet? Register   Sign In
Need help on email stuff

Hi guys

I am sending invitation email..its working fine but the thing is the output of the messsage
printing in text format instead of invitation format(invitation template)

Thanks in Advance

This is my code in controller

function sendEmail(){
if(!$this->sehelper->checkSession()) return;
$to = $this->uri->segment(3);
$Fname = $this->uri->segment(4);
$Lname = $this->uri->segment(5);
$name = $Fname.$Lname;
$mime_boundary = "----WallstreetProductions----".md5(time());
///////////////////////// Mail Header //////////////////////////////

$headers = "From:[email protected]\n";
$headers .= "Reply-To:[email protected]\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: multipart/alternative; boundary=\"$mime_boundary\"\n";

$message = "--$mime_boundary\n";
$message .= "Content-Type: text/html; charset=UTF-8\n";
$message .= "Content-Transfer-Encoding: 8bit\n\n";

$message .= "<html >\n";
$message .= "<head>";

$message .= "<style>";
$message .= "body{background-color:#000;align:center;}";
$message .= "#wrap{position:relative;width:802px;text-align:center;margin-left:200px;margin-top:0px;}";
$message .= "#sc_header{border-bottom:1px solid #bdc1a3 hidden;";
$message .= "position:relative;width:802px;height:103px;";
$message .= "background-color:#640000;background-image:url(/images/header_bg.jpg);";
$message .= "background-repeat:repeat-x;}";

$message .= "#sc_body{position:relative;border:1px solid #bdc1a3;";
$message .= "width:802px;height:448px;";
$message .= "background-color:#f3f5dc;background-image:url(/images/SE_body.jpg);";
$message .= "background-repeat:no-repeat;margin-top:10px;}";

$message .= "h1{font-family:Arial,Helvetica,sans-serif;";
$message .= "text-align:left;font-size:130%;color:#333333;font-weight:bold;";
$message .= "margin-left:100px;margin-top:100px;}";

$message .= "h2{font-family:Arial,Helvetica,sans-serif;";
$message .= "text-align:left;font-size:100%;color:#333333;font-weight:bold;";
$message .= "margin-left:100px;margin-top:10px;}";

$message .= "p{position:relative;font-family:Arial,Helvetica,sans-serif;";
$message .= "font-size:11px;color:#333333;font-weight:normal;";
$message .= "margin-left:100px;margin-top:30px;width:650px;text-align:justify;margin-bottom:50px;}";
$message .= "span.text{font-family:Arial,Helvetica,sans-serif;";
$message .= "font-size:12px;color:#333333;font-weight:bold;text-align:justify;}";
$message .= "</style>";
$message .= "</head>";

$message .= "<body>";
$message .= "<div id='wrap'>";
$message .= "<div id='sc_header'><img src='/images/SE_Header.jpg' alt='Scounting Edge'></div>";
$message .= "<div id='sc_body'>";
$message .= "<h1>Hello Friends !</h1>";

$message .= "<p>Another Biznet Poker Night is coming up and you're invited! It's a friendly game and the stakes aren't high,";
$message .= "so put your best poker face on and join the fun.<br/>";
$message .= "<br/>";
$message .= "<br/>";

$message .= "What: <strong>Texas Holdem tournament style poker followed by a cash game</strong><br/>";
$message .= "How much:<strong> $20 tournament buy in – all proceeds paid to winners</strong><br/>";
$message .= "When:<strong>Thursday, August 7th, 6:30pm</strong><br />";
$message .= "Where:<strong> Biznet World Headquarters, 28339 Beck Rd., #F-9, Wixom, MI 48393</strong> –<strong> Map It</strong><br/><br/>";

$message .= "Please feel free to bring a friend or two. Space is limited to 40 players and we usually fill every chair.";
$message .= "Please RSVP here to lock in your spot!</p>";
$message .= "<hr width='600px'size='1'>";
$message .= "<h2>Good Luck<br/>";
$message .= "<span class='text'>Kevin</span>";
$message .= "</h2>";
$message .= "</div>";
$message .= "</div>";
$message .= "&lt;/body&gt;";
$message .= "&lt;/html&gt;";
$Emailsent = @mail($to,"The Scouting Edge - Invitation",$message,$headers);
$content = strip_tags(str_replace("'",'',$message));
$inviteID = $this->genUniqueId($name);
$uEmail = $to;
$subject = "The Scouting Edge - Invitation";
$createdby = $this->sehelper->getUName();
$updatedby = $this->sehelper->getUName();
$invitedby = $this->sehelper->getUserID();
$created_on = date('Y:m:d H:iConfused');
$updated_on = date('Y:m:d H:iConfused');
$data = array('s_invite_id' =>$inviteID,'s_name'=>$name,'s_email'=>$uEmail,'s_invited_by'=>$invitedby,'s_content'=>$content,


two things... when you post code to the forums please use code tags so that the code is readable: [ code ]

and, you should use the CI email class. it is tested and easier to debug.

This line

$to = $this->uri->segment(3);

doesn't look good to me.
You should send params using POST or GET, and validate them.

Dear just read user guide

There is option for sending mail in html format.

//$config['protocol'] = 'sendmail';
//$config['mailpath'] = '/usr/sbin/sendmail';
//$config['charset'] = 'iso-8859-1';
//$config['wordwrap'] = TRUE;

$config['mailtype']='html'; //this what you need


Theme © iAndrew 2016 - Forum software by © MyBB