function get_email_body($subject, $heading, $fields, $resources) { $message = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'; $message .= '<html xmlns="http://www.w3.org/1999/xhtml">'; $message .= '<head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><title>' . encode_for_form($subject) . '</title></head>'; $message .= '<body style="background-color: #ffffff; color: #000000; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 18px; font-family: helvetica, arial, verdana, sans-serif;">'; $message .= '<h2 style="background-color: #eeeeee;">' . $heading . '</h2>'; $message .= '<table cellspacing="0" cellpadding="0" width="100%" style="background-color: #ffffff;">'; $sorted_fields = array(); foreach ($fields as $field => $properties) { // Skip reCAPTCHA from email submission if ('recaptcha' == $properties['type']) { continue; } array_push($sorted_fields, array('field' => $field, 'properties' => $properties)); } // sort fields usort($sorted_fields, 'field_comparer'); foreach ($sorted_fields as $field_wrapper) { $message .= '<tr><td valign="top" style="background-color: #ffffff;"><b>' . encode_for_form($field_wrapper['properties']['label']) . ':</b></td><td>' . get_form_field_value($field_wrapper['field'], $field_wrapper['properties'], $resources, true) . '</td></tr>'; } $message .= '</table>'; $message .= '<br/><br/>'; $message .= '<div style="background-color: #eeeeee; font-size: 10px; line-height: 11px;">' . sprintf($resources['submitted_from'], encode_for_form($_SERVER['SERVER_NAME'])) . '</div>'; $message .= '<div style="background-color: #eeeeee; font-size: 10px; line-height: 11px;">' . sprintf($resources['submitted_by'], encode_for_form($_SERVER['REMOTE_ADDR'])) . '</div>'; $message .= '</body></html>'; return cleanup_message($message); }
function get_email_body($subject, $heading, $fields) { $message = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'; $message .= '<html xmlns="http://www.w3.org/1999/xhtml">'; $message .= '<head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><title>' . encode_for_form($subject) . '</title></head>'; $message .= '<body style="background-color: #ffffff; color: #000000; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 18px; font-family: helvetica, arial, verdana, sans-serif;">'; $message .= '<h2 style="background-color: #eeeeee;">' . $heading . '</h2>'; $message .= '<table cellspacing="0" cellpadding="0" width="100%" style="background-color: #ffffff;">'; foreach ($fields as $field => $properties) { // Skip reCAPTCHA from email submission if ('recaptcha' == $properties['type']) { continue; } $message .= '<tr><td valign="top" style="background-color: #ffffff;"><b>' . encode_for_form($properties['label']) . ':</b></td><td>' . get_form_field_value($field, $properties) . '</td></tr>'; } $message .= '</table>'; $message .= '<br/><br/>'; $message .= '<div style="background-color: #eeeeee; font-size: 10px; line-height: 11px;">formulário enviado do site: ' . encode_for_form($_SERVER['SERVER_NAME']) . '</div>'; $message .= '<div style="background-color: #eeeeee; font-size: 10px; line-height: 11px;">Endereço IP do visitante: ' . encode_for_form($_SERVER['REMOTE_ADDR']) . '</div>'; $message .= '</body></html>'; return cleanup_message($message); }