0

I am developing function that send a email to user..,and i want to add some html.css styleing to the email how can i achive that folllwing is my code i tried

function zgcrons_mail ($key, &$message, $params) {
  switch ($key) {
  case 'mymail':
    // Set headers etc
    $message['to'] = $usermail;
    $message['subject'] = t('Your Donation Statues ');
    $message['body'][] = '<table width="100%" cellspacing="0" cellpadding="10" border="0">
    <tbody>
    <tr>
        <td valign="middle" style="border-collapse:collapse;border:0" colspan="2">
            <div style="color:#585858;font-family:Georgia;font-size:12px;line-height:125%;text-align:center">&nbsp;
                <a target="_blank" style="color:#ee3524;font-weight:bold;text-decoration:underline" href="http://www.twitter.com/ZealousGood/">follow on Twitter</a> | 
                <a target="_blank" style="color:#ee3524;font-weight:bold;text-decoration:underline" ref="http://www.facebook.com/ZealousGood2011">friend on Facebook</a>
            </div>
        </td>
    </tr>
    <tr>
        <td width="372" valign="top" style="border-collapse:collapse">
            <div style="color:#585858;font-family:Georgia;font-size:12px;line-height:125%;text-align:center">
                <em>Copyright &copy; 2012 Zealous Good, All rights reserved.</em> 
                <br>
            </div>
        </td>
    </tr>
    </tbody></table>';
  break;
  }
}
drupal_mail('zgcrons', 'mymail',$usermail, $language, $params = array('username' =>'John Potato'), $from = NULL, $send = TRUE); 

1 Answer 1

2

Your way will work if you enable the html format for email in your website. By using http://drupal.org/project/htmlmail or http://drupal.org/project/mimemail that will help you format the email in html and choose which method that will use for sending email.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.