I am using Yiimailer() extension in my application and below you can see the code that I am using.
$mail = new YiiMailer();
$mail->setFrom('admin@website.com', 'website');
$mail->setTo($email);
$mail->setSubject('website : Email Verification required');
$mail->setLayout('basic');
$message2 = "Please click this below to activate your membership<br />".
Yii::app()->createAbsoluteUrl('site/activate', array('key' => $registrationkey,'mail' => $email));
$mail->setBody($message2);
if ($mail->send()) {
Yii::app()->user->setFlash('contact','Please Verify Your Email');
} else {
Yii::app()->user->setFlash('error','Error while sending email: '.$mail->getError());
}
return true;
The above code , actually sets the Layout to => "Basic" which looks as below
<!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">
<head>
<!-- If you delete this meta tag, Half Life 3 will never be released. -->
<meta name="viewport" content="width=device-width" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" media="screen" href="<?php echo Yii::app()->getBaseUrl()?>/css/email.css" />
</head>
<body style="background-color:#E3DED8">
<?php echo "Base URL>>".Yii::app()->theme->getBaseUrl()."/images/logomail.png"; ?>
<!-- HEADER -->
<table class="head-wrap" bgcolor="#999999">
<tr>
<td></td>
<td class="header container" >
<div class="content">
<table bgcolor="#999999">
<tr>
<td><img src="<?php echo Yii::app()->getBaseUrl()?>/images/logomail.png" /></td>
<td align="right"><h6 class="collapse">, your one stop for all deals!</h6></td>
</tr>
</table>
</div>
</td>
<td></td>
</tr>
</table><!-- /HEADER -->
<!-- BODY -->
<table class="body-wrap">
<tr>
<td></td>
<td class="container" bgcolor="#FFFFFF">
<div class="content">
<table>
<tr>
<td>
<!-- Include content pages -->
<?php echo $content; ?>
</p><!-- /Callout Panel -->
<!-- social & contact -->
<table class="social" width="100%">
<tr>
<td>
<!-- column 1 -->
<table align="left" class="column">
<tr>
<td>
<h5 class="">Connect with US</h5>
<p class=""><a href="#" class="soc-btn fb">Facebook</a> <a href="#" class="soc-btn tw">Twitter</a> <a href="#" class="soc-btn gp">Google+</a></p>
</td>
</tr>
</table><!-- /column 1 -->
<!-- column 2 -->
<span class="clear"></span>
</td>
</tr>
</table><!-- /social & contact -->
</td>
</tr>
</table>
</div><!-- /content -->
</td>
<td></td>
</tr>
</table><!-- /BODY -->
<!-- FOOTER -->
<table class="footer-wrap">
<tr>
<td></td>
<td class="container">
<!-- content -->
<div class="content">
<table>
<tr>
<td align="center">
<p>
<a href="#">Terms</a> |
<a href="#">Privacy</a> |
<a href="#"><unsubscribe>Unsubscribe</unsubscribe></a>
</p>
</td>
</tr>
</table>
</div><!-- /content -->
</td>
<td></td>
</tr>
</table><!-- /FOOTER -->
</body>
</html>
Problem is when I receive the email , it doesn’t show me the font with correct class applied from the CSS. Also the image does not get attached. I verified the path and everything looks alright…