Related
I am using codeigniter email library to send email. My message contains html code. but couldn't send email, instead it shows error like "This message is rejected by our SPAM filters". here is my code :
email-template.php
<html>
<body>
<div style="background-color: #f3f3f3; max-width: 650px; margin: 0 auto; box-shadow: 0px 0px 25px rgba(0, 0, 0, 0.25);">
<!-- header section -->
<div style="/*border-bottom: 5px solid #cc342f;*/ border-bottom: 5px solid #fa233d; background-color: #f4f1f1; padding: 20px;">
<div style="text-align: left;">
<img src="<?php echo base_url()?>assets/images/logo.png" alt="test">
</div>
</div>
<!-- content section -->
<div style="padding: 20px 25px; text-align: justify; overflow: hidden; position: relative;">
<p style="font-family: Arial, Helvetica, sans-serif; font-weight: bold; color: #fa233d;">
Hi <?php echo $user;?>,
</p>
<p style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-weight: 100; color: #1b1b1b; line-height: 24px;">
You recently requested to reset your password for your ***** account.
</p>
<p style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-weight: 100; color: #1b1b1b; line-height: 24px;">
Click the button below to reset your password.
</p>
<p style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-weight: 100; color: #1b1b1b; line-height: 24px;">
Reset Password
</p>
<p style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-weight: 100; color: #1b1b1b; line-height: 24px;">
If you did not request a password reset, please ignore this mail.
</p>
<p style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-weight: 100; color: #1b1b1b; line-height: 24px;">
Thanks,
</p>
<p style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-weight: 100; color: #1b1b1b; line-height: 24px;">
*********
</p>
<!-- Disclaimer -->
<p style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-weight: 100; color: #1b1b1b; line-height: 14px; border: 1px solid #ddd; padding: 10px">
<small>
If you have trouble clicking the reset button, copy and paste below URL in your web browser. <br/>
Reset Password
</small>
</p>
</div>
<!-- footer section -->
<div style="border-top: 3px solid #fa233d; background-color: #f4f1f1; padding: 10px 25px; text-align: right">
<p style="margin: 0; font-family: Arial, Helvetica, sans-serif; font-size: 11px; color: #1d1d1d; text-decoration: none; display: inline-block;">+91 1231 123123 <span style="color: #fa233d;">|</span> +91 123123 12313 </p>
<span style="color: #fa233d;">|</span> Visit Us
</div>
</div>
</body>
home.php controller
public function forgotPassword() {
$email = $this->input->post('email');
$password = ******
$user = $this->Home_model->findUsernameByEmail($email);
$data = array('email' => $email,
'password' => $password,
'user' => $user);
$body = $this->load->view('templates/forgot-password', $data, true);
$result = $this->Home_model->forgotPassword($email, $body);
echo $result;
}
and Home_model.php
function forgotPassword($email, $message){ //print_r( $message); exit;
$this->db->where('LoginEmailID', $email);
$result = $this->db->get('usermaster_tbl')->row_array();
if($result['UserID'] != 0 && $result['UserID'] != ''){
$this->email->message($message);
$this->email->to($email);
$this->email->from('****#****.in', 'Administrator');
$this->email->subject('Reset Password');
$this->email->send();
print_r($this->email->print_debugger());
return 1;
}
else{
return 0;
}
}
if i use message other than html code, it is working. But if html template used, then mail is not sent
Add mailtype in your config
$config = Array(
'mailtype' => 'html',
...etc...
);
See http://codeigniter.com/user_guide/libraries/email.html
1- In your configuration file located in Applications / config / email.php you must put the following
$config['protocol'] = 'smtp';
$config['charset'] = 'utf8';
$config['wordwrap'] = TRUE;
$config['smtp_host'] = 'ssl://smtp.googlemail.com';
$config['smtp_port'] = 465;
$config['smtp_user'] = "youemail#gmail.com";
$config['smtp_pass'] = "yourpass";
$config['newline'] = "\r\n";
$config['priority'] = 1;
$config['mailtype'] = 'html'; //very important to send email html
2 - In order for your emails not to be detected as spam you must configure the from with the same mail that you put in the configuration file email.php
$this->email->from('myemail#gmail.com', 'Administrator');
I found my answer. Actually the problem is with url's used in template for image and anchor. I'm testing it with local server, so the link been blocked by mail server security. I changed it to live site url. Now the problem solved.
Thank you all for your valuable suggestions.
I have email content with data=> name, email, phone , description and attachment.
I am able send the email with all the data to email. But what I want is , Actually I want to send attachments to the email content. But in my code I just sending the links to the email content. But If I click on that links it is not downloading. I need to send attachments to the email and also when I click on that it should download. How to resolve this. Plese somebody help me.
Below is code,
$name = $this->request->post['name'];
$email = $this->request->post['email'];
$description = $this->request->post['description'];
$phone = $this->request->post['phone'];
$upload_base_dir="image/service-images/";
$upload_time_dir=time(); // setup directory name
$upload_dir = $upload_base_dir.$upload_time_dir;
if (!file_exists($upload_dir)) {
mkdir($upload_dir, 0775, true); //create directory if not exist
}
foreach($_FILES['attachment']['error'] as $k=>$v)
{
$uploadfile = $_FILES['attachment']['name'][$k];
move_uploaded_file($_FILES['attachment']['tmp_name'][$k],$upload_dir."/".$uploadfile);
$subject = 'Service Request';
$email_header ='<html style="color: rgb(34, 34, 34); font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); max-width: 575px; line-height: 18px; font-size: 12px; font-family: Arial, Helvetica, sans-serif;"><head><meta name="viewport" content="width=device-width" /><meta http-equiv="content-type" content="text/html; charset=UTF-8"></head><body bgcolor="#FFFFFF" text="#000000" style="color: rgb(34, 34, 34); font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); max-width: 575px; line-height: 18px; font-size: 12px; font-family: Arial, Helvetica, sans-serif;"><table style="font-family:Helvetica,Arial,sans-serif;background:#EFEDED;" cellpadding="0" cellspacing="0" bgcolor="#EFEDED" border="0" width="100%"><tbody><tr><td align="center"><table width="96%" cellpadding="0" cellspacing="0"border="0"><tbody><tr><td style="border-top:5px solid #1e96d3; background:#fff;margin:0; padding:20px; border-spacing:0px;">';
$email_footer = '</td></tr><tr><td style="margin:0; padding:15px 0;"><table style="font-family:Arial, Helvetica,sans-serif;font-size:11px;color:#999999;" cellpadding="0" cellspacing="0" border="0" width="100%"><tbody> <tr>
<td style="font-family:Arial, Helvetica,sans-serif; margin:0; font-size:11px; padding:8px 0 0 0;">This email was intended for Inf. </td></tr><tr>
<td style="font-family:Arial, Helvetica,sans-serif; margin:0; font-size:11px; padding:8px 0 0 0;"></td></tr></tbody></table></td></tr></tbody></table></td>
</tr></tbody></table></body></html>';
$body = $email_header.'<table width="100%" cellpadding="0" cellspacing="0"><tr>
<td style="margin:0; padding:0px 0px 15px 0px; border-spacing:0px;">
<p style="font-size:14px; color: rgb(0, 0, 0); font-family: Arial, Helvetica, sans-serif; font-weight: bold; line-height: 1.5em; margin: 0px; padding: 0.4em; text-align: left;">'.$subject.'</p></td></tr><tr><td style="margin:0; padding:0px 0px 15px 0px; border-spacing:0px;"><p style="color:#000; font-size:13px; margin:0; font-family:Arial, Helvetica,sans-serif;"><strong>Dear Sir/Madam,</strong><br></p></td></tr><tr><td style="margin:0; padding:0 0 5px 0;"><p style="font-size:13px; background-color: rgb(234, 234, 234); color: rgb(0, 0, 0); font-family: Arial, Helvetica, sans-serif; font-weight: bold; line-height: 1.5em; margin: 0px; padding: 0.4em; text-align: left;">Details:</p></td></tr><tr><td style="margin:0; padding:0px 0px 15px 0px; border-spacing:0px;"><table style="font-family:Helvetica,Arial,sans-serif; font-size:12px; font-weight:bold; margin-top:10px; width:100%"><tbody>
<tr><td style="padding:4px 0;">Name</td>
<td>:</td><td style="font-weight:normal;">'.$name.'</td></tr>
<tr><td style="padding:4px 0;">Email Address</td>
<td>:</td><td style="font-weight:normal;">'.$email.'</td></tr>
<tr><td style="padding:4px 0;">Phone</td><td>:</td><td style="font-weight:normal;">'.$phone.'</td></tr>
<tr><td style="padding:4px 0;">Description</td><td>:</td><td style="font-weight:normal;">'.$description.'</td></tr>
<tr><td style="padding:4px 0;">Attachments</td><td>:</td><td style="font-weight:normal;">';
foreach($_FILES['attachment']['error'] as $k=>$v)
{
$uploadfile = $_FILES['attachment']['name'][$k];
move_uploaded_file($_FILES['attachment']['tmp_name'][$k],$upload_dir."/".$uploadfile);
$images[] = $_FILES['attachment']['name'][$k];
$count=0;
foreach($images as $image){
$count++;
}
if($_SERVER['HTTP_HOST'] == "localhost"){
$body .= '<a href='.'localhost'."/inf/".$upload_dir."/".$image.' download>Attachment'.$count.'</a> ';
}
if($_SERVER['HTTP_HOST'] == "192.168.1.156"){
$body .= '<a href='.'192.168.1.156'."/inf/".$upload_dir."/".$image.' download>Attachment'.$count.'</a> ';
}
if($_SERVER['HTTP_HOST'] == "floretmedia.net"){
$body .= '<a href='."http://floretmedia.net/temp"."/inf/".$upload_dir."/".$image' download>'.$image.'</a> ';
}
if($_SERVER['HTTP_HOST'] == "www.arbour.in" || $_SERVER['HTTP_HOST'] == "arbour.in"){
$body .= '<a href='.'http://www.arbour.in'."/".$upload_dir."/".$image.' download>Attachment'.$count.'</a> ';
}
}
$body .= '</td></tr></tbody></table></td></tr></table>'.$email_footer.'';
//echo $body;die;
$mail = new Mail($this->config->get('config_mail'));
$mail->setTo($this->config->get('config_email'));
$mail->setFrom($email);
$mail->setSender($name);
$mail->setSubject($subject);
$mail->setHtml($body);
$mail->send();
you can attach the file to the body like this
$body .= '</td></tr></tbody></table></td></tr></table>'.$email_footer.'';
$filename = 'myfile';
$path = 'your path goes here';
$file = $path . "/" . $filename;
$content = file_get_contents($file);
$content = chunk_split(base64_encode($content));
$body .= $content . "\r\n";
// send the mail
$mail = new Mail($this->config->get('config_mail'));
$mail->setTo($this->config->get('config_email'));
$mail->setFrom($email);
$mail->setSender($name);
$mail->setSubject($subject);
$mail->setHtml($body);
$mail->send();
I would like to send and email trough the PHPMailer class. The code doesn't launch any error but the method $mail -> Send() returns false and I don't know why.
$emailList looks like:
Array(
[0] => mate80#yopmail.com
[1] => mate81#yopmail.com)
The ./html/mail/index.html looks like:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- If you delete this meta tag, the ground will open and swallow you. -->
<meta name="viewport" content="width=device-width" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>TeamEQ</title><style type="text/css">img {max-width: 100%;}body {-webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; width: 100% !important; height: 100%;}#media only screen and (max-width: 600px) { a[class="btn"] {
display: block !important; margin-bottom: 10px !important; background-image: none !important; margin-right: 0 !important; }div[class="column"] {
width: auto !important; float: none !important; }table.social div[class="column"] { width: auto !important;}}
<!-- HEADER -->
<table class="head-wrap" bgcolor="#999999" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; width: 100%; background: white; margin: 0; padding: 0;">
<tr style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 0;">
<td style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 0;"></td>
<td class="header container" align="" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; display: block !important; max-width: 600px !important; clear: both !important; margin: 0 auto; padding: 0;">
<!-- /content -->
<div class="content" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; max-width: 600px; display: block; margin: 0 auto; padding: 15px;">
<table style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; width: 100%; margin: 0; padding: 0;">
<tr style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 0;">
<td class="logo" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; text-align: center; margin: 0; padding: 15px;" align="center"><img src="{#urlToLogo}" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; max-width: 100%; margin: 0; padding: 0;" /></td>
</tr>
</table>
</div>
<!-- /content -->
</td>
<td style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 0;"></td>
</tr>
</table>
<!-- /HEADER -->
<!-- BODY -->
<table class="body-wrap" bgcolor="" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; width: 100%; margin: 0; padding: 0;">
<tr style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 0;">
<td style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 0;"></td>
<td class="container" align="" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; display: block !important; max-width: 600px !important; clear: both !important; margin: 0 auto; padding: 0;">
<!-- content -->
<div class="content" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; max-width: 600px; display: block; margin: 0 auto; padding: 15px;">
<table style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; width: 100%; margin: 0; padding: 0;">
<tr style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 0;">
<td style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 0;">
<h1 style="font-family: 'HelveticaNeue-Light', 'Helvetica Neue Light', 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; line-height: 1.1; color: #000; font-weight: 200; font-size: 44px; margin: 0 0 15px; padding: 0;">Bienvenid#!</h1>
<p class="lead" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-weight: normal; font-size: 17px; line-height: 1.6; margin: 0 0 10px; padding: 0;"></p>
<!-- A Real Hero (and a real human being) -->
<!--<p><img class="quote" src="https://s-media-cache-ak0.pinimg.com/236x/ad/5c/92/ad5c92c02290a4cb06dbcda734dc09da.jpg" /></p>-->
<p style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-weight: normal; font-size: 14px; line-height: 1.6; margin: 0 0 10px; padding: 0;">Has sido invitad# al equipo {#teamName} por parte de {#teamLeader}.</p>
<p style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-weight: normal; font-size: 14px; line-height: 1.6; margin: 0 0 10px; padding: 0;">Para completar el registro pulsa aquí, o copia el siguiente enlace en tu navegador:</p>
<!--
#env teameq-frontend.cloudapp.net variable de entorno.
Cambiar en la rama env las variables de entorno para el link de retorno del mail de invitación de usuarios.
-->
<p style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-weight: normal; font-size: 14px; line-height: 1.6; margin: 0 0 10px; padding: 0;">http://app.teameq.net/#/signup/teammate/{#teamId}/{#invitationalToken}</p>
<br style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 0;" />
<p style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-weight: normal; font-size: 14px; line-height: 1.6; margin: 0 0 10px; padding: 0;">Gracias por tu atención, estamos ilusionados por ver cómo TeamEQ mejora tu entorno laboral!</p>
<!-- /hero -->
</td>
</tr>
</table>
</div>
</td>
<td style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 0;"></td>
</tr>
</table>
<!-- /BODY -->
The code updated with comments below is:
$teamMembers = $bbdd -> getTeam($teamId);
for($i=0; $i<count($emailList); $i++)
{
$userExistInTeam = false;
foreach($teamMembers as $key => $member)
{
if($member['email'] == $emailList[$i])
{
$userExistInTeam = true;
}
}
if(!$userExistInTeam)
{
$user = insertInitialTeamMate($teamId, $emailList[$i], $teamLeader["companyId"]);
$emailTemplate = file_get_contents('./html/mail/index.html');
$emailValues = array(
'{#urlToLogo}' => 'http://dapalmes.com/teamEQapiRC/html/mail/img/teameq-logo.png',
'{#teamName}' => $teamLeader["teamName"],
'{#teamLeader}' => $teamLeader["name"] ." ". $teamLeader["surname"],
'{#invitationalToken}' => $user["token"],
'{#teamId}' => $teamId
);
$mail = new PHPMailer(true);
$body = strtr($emailTemplate, $emailValues);
$mail -> setFrom('no-reply#teameq.net', 'TeamEQ');
$mail -> AddAddress($emailList[$i]);
$mail -> Subject = "Has sido invitado a TeamEQ";
$mail -> MsgHTML($body);
// $result = $mail -> Send();
if(!$mail->Send())
{
echo "error al enviar!!";
}
else
{
echo "mensaje enviado";
}
}
}
the error was that the Send method is written lower case
You have an error in this line . Instead of
$mail -> AddAdress =$emailList[$i];
Use
$mail -> AddAddress($emailList[$i]);
Also this code will send the mail twice. so remove this line.
$result = $mail -> Send();
You shouldn't be calling Send() twice, check for $result instead:
$result = $mail -> Send();
if(!$result)
{
echo "send KO";
}
else
{
echo "send OK";
}
Also; try using $mail = new PHPMailer(true); instead; it should enable Exceptions and will tell you if & why sending failed
i want to integrate template inside my email but the problem is that the path of the template that i am giving once arrived at my email box is displayed as a text.
so my script is :
$mail->From = 'user#gator4339.hostgator.com';
$mail->FromName = 'fekri';
$mail->addAddress('asa#gmail.com', 'fdgf'); // Add a recipient
$mail->addAddress('sa#gmail.com'); // Name is optional
$mail->addReplyTo('sa#gmail.com', 'ss');
$mail->addCC('cc#example.com');
$mail->addBCC('bcc#example.com');
$mail->isHTML(true); // Set email format to HTML
$message = realpath(dirname(__FILE__)) .'/../views/emailFoldre/sendemails.php';
$headers = 'from fekrin';
$mail->Body = realpath(dirname(__FILE__)) .'/../views/emailFoldre/sendemails.php';
// $mail->AltBody = 'This is a plain-text message body';
//mail('maqajma#gmail.com', $headers , $message);
if(!$mail->send()){
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent';
}
and as result i get home/publi_html..../../views/emailFoldre/sendemails.php
this is sendemails.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns="http://www.w3.org/1999/xhtml" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 0;">
<head>
<!-- If you delete this tag, the sky will fall on your head -->
<meta name="viewport" content="width=device-width" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>ZURBemails</title>
</head>
<body bgcolor="#FFFFFF" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: none; width: 100% !important; height: 100%; margin: 0; padding: 0;">
<!-- HEADER -->
<table class="head-wrap" bgcolor="#999999" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; width: 100%; margin: 0; padding: 0;"><tr style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 0;"><td style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 0;"></td>
<td class="header container" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; display: block !important; max-width: 600px !important; clear: both !important; margin: 0 auto; padding: 0;">
<div class="content" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; max-width: 600px; display: block; margin: 0 auto; padding: 15px;">
<table bgcolor="#999999" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; width: 100%; margin: 0; padding: 0;"><tr style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 0;"><td style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 0;"><img src="http://placehold.it/200x50/" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; max-width: 100%; margin: 0; padding: 0;" /></td>
<td align="right" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 0;"><h6 class="collapse" style="font-family: 'HelveticaNeue-Light', 'Helvetica Neue Light', 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; line-height: 1.1; color: #444; font-weight: 900; font-size: 14px; text-transform: uppercase; margin: 0; padding: 0;">Hero</h6></td>
</tr></table></div>
</td>
<td style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 0;"></td>
</tr></table><!-- /HEADER --><!-- BODY --><table class="body-wrap" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; width: 100%; margin: 0; padding: 0;"><tr style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 0;"><td style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 0;"></td>
<td class="container" bgcolor="#FFFFFF" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; display: block !important; max-width: 600px !important; clear: both !important; margin: 0 auto; padding: 0;">
<div class="content" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; max-width: 600px; display: block; margin: 0 auto; padding: 15px;">
<table style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; width: 100%; margin: 0; padding: 0;"><tr style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 0;"><td style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 0;">
<h3 style="font-family: 'HelveticaNeue-Light', 'Helvetica Neue Light', 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; line-height: 1.1; color: #000; font-weight: 500; font-size: 27px; margin: 0 0 15px; padding: 0;">Welcome, Elijah Baily</h3>
<p class="lead" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-weight: normal; font-size: 17px; line-height: 1.6; margin: 0 0 10px; padding: 0;">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et.</p>
<!-- A Real Hero (and a real human being) -->
<p style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-weight: normal; font-size: 14px; line-height: 1.6; margin: 0 0 10px; padding: 0;"><img src="http://placehold.it/600x300" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; max-width: 100%; margin: 0; padding: 0;" /></p><!-- /hero -->
<!-- Callout Panel -->
<p class="callout" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-weight: normal; font-size: 14px; line-height: 1.6; background-color: #ECF8FF; margin: 0 0 15px; padding: 15px;">
votre message a été envoyé à l'Annonceur avec avec Succès, Merci. Do it Now! »
</p><!-- /Callout Panel -->
<h3 style="font-family: 'HelveticaNeue-Light', 'Helvetica Neue Light', 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; line-height: 1.1; color: #000; font-weight: 500; font-size: 27px; margin: 0 0 15px; padding: 0;">Title Ipsum <small style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-size: 60%; color: #6f6f6f; line-height: 0; text-transform: none; margin: 0; padding: 0;">This is a note.</small></h3>
<p style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-weight: normal; font-size: 14px; line-height: 1.6; margin: 0 0 10px; padding: 0;">votre message a été envoyé à l'Annonceur avec avec Succès, Merci.</p>
<a class="btn" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; color: #FFF; text-decoration: none; font-weight: bold; text-align: center; cursor: pointer; display: block !important; background-image: none !important; background-color: #666; margin: 0 0 10px; padding: 10px 16px;">Click Me!</a>
<br style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 0;" /><br style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 0;" /><!-- social & contact --><table class="social" width="100%" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; width: 100%; background-color: #ebebeb; margin: 0; padding: 0;" bgcolor="#ebebeb"><tr style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 0;"><td style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 0;">
<!--- column 1 -->
<table align="left" class="column" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; width: 280px; float: left; min-width: 279px; margin: 0; padding: 0;"><tr style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 0;"><td style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 15px;">
<h5 class="" style="font-family: 'HelveticaNeue-Light', 'Helvetica Neue Light', 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; line-height: 1.1; color: #000; font-weight: 900; font-size: 17px; margin: 0 0 15px; padding: 0;">Connect with Us:</h5>
<p class="" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-weight: normal; font-size: 14px; line-height: 1.6; margin: 0 0 10px; padding: 0;">Facebook Twitter Google+</p>
</td>
</tr></table><!-- /column 1 --><!--- column 2 --><table align="left" class="column" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; width: 280px; float: left; min-width: 279px; margin: 0; padding: 0;"><tr style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 0;"><td style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 15px;">
<h5 class="" style="font-family: 'HelveticaNeue-Light', 'Helvetica Neue Light', 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; line-height: 1.1; color: #000; font-weight: 900; font-size: 17px; margin: 0 0 15px; padding: 0;">Contact Info:</h5>
<p style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-weight: normal; font-size: 14px; line-height: 1.6; margin: 0 0 10px; padding: 0;">Phone: <strong style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 0;">408.341.0600</strong><br style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 0;" />
Email: <strong style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 0;">hseldon#trantor.com</strong></p>
</td>
</tr></table><!-- /column 2 --><span class="clear" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; display: block; clear: both; margin: 0; padding: 0;"></span>
</td>
</tr></table><!-- /social & contact --></td>
</tr></table></div>
</td>
<td style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 0;"></td>
</tr></table><!-- /BODY --><!-- FOOTER --><table class="footer-wrap" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; width: 100%; clear: both !important; margin: 0; padding: 0;"><tr style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 0;"><td style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 0;"></td>
<td class="container" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; display: block !important; max-width: 600px !important; clear: both !important; margin: 0 auto; padding: 0;">
<!-- content -->
<div class="content" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; max-width: 600px; display: block; margin: 0 auto; padding: 15px;">
<table style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; width: 100%; margin: 0; padding: 0;"><tr style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 0;"><td align="center" style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 0;">
<p style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; font-weight: normal; font-size: 14px; line-height: 1.6; margin: 0 0 10px; padding: 0;">
Terms |
Privacy |
<unsubscribe style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 0;">Unsubscribe</unsubscribe>
</p>
</td>
</tr></table></div><!-- /content -->
</td>
<td style="font-family: 'Helvetica Neue', 'Helvetica', Helvetica, Arial, sans-serif; margin: 0; padding: 0;"></td>
</tr></table><!-- /FOOTER --></body>
</html>
The $mail->Body in this code is set to the file's name, and not the file's content. To fix it, and assuming the file name is correct, the following line:
$mail->Body = realpath(dirname(__FILE__)) .'/../views/emailFoldre/sendemails.php';
Should be simply changed to:
$mail->Body = file_get_contents(realpath(dirname(__FILE__)) .'/../views/emailFoldre/sendemails.php');
Notes:
$message isn't used anywhere - it's better to remove it to avoid confusion
Indentation really needs to be fixed
Not sure why it's doing this, but I'm getting the following syntax error: "Unexpected "<" on Line1".
I can't seem to find out what is the problem, I've already tried troubleshooting the problem earlier before posting this.
Here's my code:
<?php
include($_SERVER["DOCUMENT_ROOT"].'/admin/classes/classes.php'); // Include local class lib
$sess = new SessionData(); // Creates session object
//$sess->CheckValidFBSession();
if($sess->CheckValidSession()){
header('Location: home.php');
}
$log= new log($_SERVER["PHP_SELF"], $_GET, $_POST, $_SERVER['HTTP_REFERER'] );
$stats=new Statistics();
$totalusers=$stats->totalscope();
?>
<html xmlns:fb="//www.facebook.com/2008/fbml">
<style>
.title {
color:#000000;
font-Family: Tahoma, Arial, Helvetica, sans-serif;
font-size: 18px;
font-weight: bold;
text-decoration:none;
}
.larger {
color:#000000;
font-Family: Tahoma, Arial, Helvetica, sans-serif;
font-size: 13px;
font-weight: none;
text-decoration:none;
}
.larger-a {
//color:#D19160;
color:#538ADC;
font-Family: Tahoma, Arial, Helvetica, sans-serif;
font-size: 13px;
font-weight: none;
text-decoration:none;
}
.larger-a:hover {
//color:#FF0000;
color:#77C9F3;
font-Family: Tahoma, Arial, Helvetica, sans-serif;
font-size: 13px;
font-weight: none;
text-decoration:underline;
}
select {
font-family: Tahoma;
font-size: 11px;
}
.white {
color:#FFFFFF;
font-Family: Tahoma, Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: none;
text-decoration:none;
}
.blue {
color:#3B5998;
font-Family: Tahoma, Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: none;
text-decoration:none;
}
.red {
color:#FF0000;
font-Family: Tahoma, Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: none;
text-decoration:none;
}
.menu {
color:#FFFFFF;
font-Family: Tahoma, Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: none;
text-decoration:none;
}
.menu:hover {
color:#77C9F3;
font-Family: Tahoma, Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: none;
text-decoration:none;
}
.alternate {
color:#3B5998;
font-Family: Tahoma, Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: none;
text-decoration:none;
}
.alternate:hover {
color:#000000;
font-Family: Tahoma, Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: none;
text-decoration:underline;
}
a {
//color:#D19160;
color:#538ADC;
font-Family: Tahoma, Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: none;
text-decoration:none;
}
a:hover {
//color:#FF0000;
color:#77C9F3;
font-Family: Tahoma, Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: none;
text-decoration:underline;
}
.bordertable {
border-width: 1px;
border-color: #3B5998;
border-style: solid;
}
.dashedtable {
border-width: 1px;
border-color: #3B5998;
border-style: dashed;
}
.bottomborder {
border-style:solid;
border-color: #3B5998;
border-top-width:0px;
border-bottom-width:1px;
border-right-width:0px;
border-left-width:0px;
}
.one-column {
color:#000000;
font-Family: Tahoma, Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: none;
text-decoration:none;
border-style:solid;
border-color: #3B5998;
border-top-width:1px;
border-bottom-width:0px;
border-right-width:1px;
border-left-width:1px;
}
.text {
font-Family: Serif;
font-size: 11px;
font-weight: none;
text-decoration:none;
}
.td0 {
color:#000000;
background-color:#D9DFEA;
border: 0;
font-Family: Tahoma, Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: none;
text-decoration:none;
}
.td1 {
color:#000000;
background-color:#86A1CE;
border: 0;
font-Family: Tahoma, Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: none;
text-decoration:none;
}
.schedule_table {
border-right-width: 0px;
border-bottom-width: 0px;
border-left-width: 1px;
border-top-width: 1px;
border-style: solid;
border-color: #000000;
}
.top-border {
border-right-width: 0px;
border-bottom-width: 0px;
border-left-width: 0px;
border-top-width: 1px;
border-style: solid;
border-color: #3B5998;
}
.schedule {
color:#000000;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 0px;
border-top-width: 0px;
border-style: solid;
border-color:#000000;
font-Family: Tahoma, Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: none;
text-decoration:none;
}
.border-td {
color:#000000;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-top-width: 1px;
border-style: solid;
border-color:#3B5998;
font-Family: Tahoma, Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: none;
text-decoration:none;
}
td {
color:#000000;
border: 0;
font-Family: Tahoma, Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: none;
text-decoration:none;
}
.inputtext {
border:double;
border-width:1;
border-color:#555555;
background-color:#D9DFEA;
font-size:11px;
color: #000000;
font-Family: Tahoma, Arial, Helvetica, sans-serif;
}
.inputsubmit {
border-style:solid;
border-top-width:1px;
border-bottom-width:2px;
border-right-width:2px;
border-left-width:1px;
border-top-color:#D9DFEA;
border-bottom-color:#3B5998;
border-right-color:#3B5998;
border-left-color:#D9DFEA;
background-color:#538ADC;
font-family:Tahoma, arial;
font-size:11px;
color:#FFFFFF;
font-weight:none;
}
a img{
border:none !important;
}
#container{
margin:0 auto;
width:500px;
padding:40px;
text-align:left;
background-color:#fff;
}
#lightbox h2{
margin:0 0 1em 0;
}
#lightbox h3{
color:#FF713F;
}
#lightbox.done p{
color:#333;
}
#form{
text-align:left;
margin:25px;
}
#form ul{
list-style:none;
}
#form li{
margin:0 0 1em 0;
}
#form textarea{
width:100%;
height:150px;
}
#definition{
margin:25px;
}
.highlight{
background-color:#FEFFAF;
}
#lightbox{
display:none;
position: absolute;
top:50%;
left:50%;
z-index:9999;
width:400px;
height:200px;
padding:10px;
margin:-220px 0 0 -250px;
border:1px solid #fff;
background:#FDFCE9;
text-align:left;
}
#lightbox[id]{
position:fixed;
}
#overlay{
display:none;
position:absolute;
top:0;
left:0;
width:100%;
height:100%;
z-index:5000;
background-color:#000;
-moz-opacity: 0.8;
opacity:.80;
filter: alpha(opacity=80);
}
#overlay[id]{
position:fixed;
}
#lightbox.done #lbLoadMessage{
display:none;
}
#lightbox.done #lbContent{
display:block;
}
#lightbox.loading #lbContent{
display:none;
}
#lightbox.loading #lbLoadMessage{
display:block;
}
#lightbox.done img{
width:100%;
height:100%;
}
<!--
#8EA7C5 - blue
#D9DFEA - grey
59 89 152 (#3B5998)
217 223 234 (#D9DFEA)
83 138 220 - link normal (#538ADC)
119 201 243 - link down (#77C9F3)
-->
</style>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : '<?php echo $sess->fbappid; ?>',
session : <?php echo json_encode($sess->fbsession); ?>, // don't refetch the session when PHP already has it
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
};
(function() {
var e = document.createElement('script');
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
}());
</script>
<title>Kuarrel | Welcome to Kuarrel!</title>
<meta name="description" content="Kuarrel is an online directory that connects people from throughout the world." />
<meta name="keywords" content="kuarrel, chaibear, chai, sa-mp, sa:mp, 2014" />
<meta name="Generator" content="JB engine designed" />
<meta name="robots" content="index, follow" />
<meta name="OriginalPublicationDate" content="2014/03/12/01:37:22">
<meta name="Headline" content="Kuarrel | Welcome to Kuarrel!">
<meta name="IFS_URL" content="/index.php">
<meta name="contentFlavor" content="PAGE">
<meta name="CPS_SITE_NAME" content="Kuarrel | Welcome to Kuarrel">
<meta name="CPS_SECTION_PATH" content="Index">
<meta name="CPS_ASSET_TYPE" content="STY">
<meta name="CPS_PLATFORM" content="HighWeb">
<meta name="CPS_AUDIENCE" content="US">
<meta property="og:title" content="Kuarrel is an online directory that connects people from throughout the world.">
<meta property="og:type" content="website">
<meta property="og:description" content="Kuarrel is an online directory that connects people from throughout the world.">
<meta property="og:image" content="http://www.kuarrel.tk/images/logo-right.jpg">
<meta property="og:url" content="http://www.kuarrel.tk/index.php">
<meta property="og:site_name" content="Kuarrel">
<!-- sO3vWw3hwrnxdrwPGTKy2ZOW6yU -->
</head>
<body>
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.Canvas.setAutoResize();
};
(function() {
var e = document.createElement('script'); e.async = true;
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);
}());
</script>
<script src="//connect.facebook.net/en_US/all.js#appId=194568130593245&xfbml=1"></script>
<center>
<table class="bordertable" cellspacing=0 cellpadding=0 border=0 width=700>
<tr><td>
<table class="bottomborder" cellspacing=0 cellpadding=0 border=0 width=100%>
<tr><td width=350 bgcolor=#3B5998>
<img src='images/logo-left.jpg'></td>
<td><table cellspacing=0 cellpadding=0 border=0 width=100%><tr><td>
<table cellspacing=0 cellpadding=0 border=0 width=100%>
<tr><td><a href='register.php'><img alt='Register' src='images/logo-right.jpg' border=0></a></td>
<td width=100% bgcolor=#3B5998> </td></tr></table></td></tr>
<tr><td><table cellspacing=0 cellpadding=4 border=0 width=100%><tr height=21>
<!--<td bgcolor=#3B5998 width=10> </td>-->
<?PHP
if(!$sess->CheckValidSession()){
include('modules/default/topnav.php');
}else{
include('modules/loggedin/topnav.php');
}
?> <td bgcolor=#3B5998 width=100%> </td>
</tr></table></td>
</tr></table>
</td></tr></table>
</td></tr>
<tr><td><table cellspacing=0 cellpadding=2 border=0 width=100%>
<tr><td valign=top>
<table cellspacing=0 cellpadding=0 border=0 width=105>
<tr><td>
<?PHP
if(!$sess->CheckValidSession()){
include('modules/default/leftnav.php');
}else{
include('modules/loggedin/leftnav.php');
}
?>
</td></tr>
</table>
</td><td width=595 valign=top>
<table class="bordertable" cellspacing=0 cellpadding=0 border=1 width=100%><tr><td>
<table cellspacing=0 cellpadding=2 border=0 width=100%>
<tr><td class='white' bgcolor=#3B5998>Welcome to Kaurrel!</td></tr></table><center><p class='title'>[ Welcome to Kaurell ]<br>
<table cellspacing=0 cellpadding=0 border=0 width=95%>
<tr><td class='larger'><?=(!empty($_GET['error']));?>"<span style='color:red;font-size:16px;'>Facebook login has been disabled for today, please try again tomorrow.</span><br><br>Kaurell is an online directory that connects people from Facebook through social networks at colleges.
<p>We have opened up Kaurell for popular consumption at <b>all colleges and universities</b>. If you are not part of a college or university, you will be added to the default Kaurell network.
<p>Your account is limited to your own college or university.
<p>You can use Kaurell to:
<br> <b>•</b> Search for people at your school
<br> <b>•</b> Find out who are in your classes
<br> <b>•</b> Look up your friends' friends
<br> <b>•</b> See a visualization of your social network
<p>To get started, click below to register with your Facebook account.<!--<br><font size="+1">Join the <?=$totalusers?> people at Kaurell today.</font>-->
<center>
<?php if(strlen($_SESSION['notpartofacollege'])>2){
echo "<b>".$_SESSION['notpartofacollege']."</b>";
}
?>
<div id="fb-root"></div>
<center><input class='inputsubmit' type="button" value='Register' onclick='javascript:document.location="register.php";'> <input class='inputsubmit' type="button" value=' Login ' onclick='javascript:document.location="login.php";'>
<br> </td></tr></table> </td></tr></table>
</td></tr></table>
<center>
<?PHP include('modules/default/bottomnav.php'); ?>
</center><br>
</td></tr></table>
Thanks to anyone who can figure out what's going on here!
try to correct
<?=(!empty($_GET['error']))?
to
<?=(!empty($_GET['error']));?>
also </span><br><br>":""?> to </span><br><br>