Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- defined('_JEXEC') or die;
- class PlgSystemSandra extends JPlugin
- {
- public function onSubmitContact($contact, $data)
- {
- if (!empty($data['contact_email_copy']))
- {
- $app = JFactory::getApplication();
- $mailfrom = $app->get('mailfrom');
- $fromname = $app->get('fromname');
- $sitename = $app->get('sitename');
- $name = $data['contact_name'];
- $email = JStringPunycode::emailToPunycode($data['contact_email']);
- $subject = $data['contact_subject'];
- $body = $data['contact_message'];
- // Design it here Sandra
- $copytext = '
- <style>
- </style>
- ';
- $copytext .= JText::sprintf('COM_CONTACT_COPYTEXT_OF', $contact->name, $sitename);
- $copytext .= "\r\n\r\n" . $body;
- $copytext = $this->getHtmlMailSkeleton() . $copytext . '</body></html>';
- $copysubject = JText::sprintf('COM_CONTACT_COPYSUBJECT_OF', $subject);
- $copytext = nl2br($copytext);
- $mail = JFactory::getMailer();
- $mail->isHtml(true);
- $mail->addRecipient($email);
- $mail->addReplyTo($email, $name);
- $mail->setSender(array($mailfrom, $fromname));
- $mail->setSubject($copysubject);
- $mail->setBody($copytext);
- $sent = $mail->Send();
- }
- return true;
- }
- protected function getHtmlMailSkeleton()
- {
- $body = array();
- // Doctype XHTML, still the most compatible one
- $body[] = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional //EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
- $body[] = '<html>';
- $body[] = '<head>';
- $body[] = '<style type=\"text/css\">';
- $body[] = 'html, body {';
- $body[] = "font-family: Verdana, Tahoma, Arial;";
- $body[] = "font-size:14px;";
- $body[] = '}';
- // Add more CSS
- $body[] = '</style>';
- $body[] = '</head>';
- $body[] = '<body>';
- return implode("\n", $body);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement