Parsing HTML in an email with PHP -


i have form using capture name , email user. when user submits form email fired specified recipient containing link.

i had working realised needed add html footer email being read plain text.

after doing digging have tried set footer read html ,but email no longer sends. not php developer.

my question have missed or way off?

<?php  // configure $from = 'ether solutions sales <email@domain.co.uk>'; $sendto = $_post['remail']; $subject = "test email"; $name = $_post['name']; $okmessage = 'your message has been sent successfully, please ask recipient check inbox'; $errormessage = 'there error while submitting form. please try again later';  // send html mail, content-type header must set  $headers  = 'mime-version: 1.0' . "\r\n";  $headers .= 'content-type: text/html; charset=iso-8859-1' . "\r\n";   // create email headers  $headers .= 'from: '.$from."\r\n".'reply-to: '.$from."\r\n" . 'x-mailer: php/' . phpversion();  // compose simple html email message  $message = '<html><body>';  $message .= '<p style="margin-bottom:30px;">regards dave</p>';  $message .= '<a href="http://www.domain.co.uk" title="link domain website">www.domain.co.uk</a>'; $message .= '<p style="font-color:blue;">office tel: 0844 000 000</p>'; $message .= '<p style="font-color:blue;">mobile: 0000 000 0000</p>'; $message .= '<p style="font-color:blue;">technical support: 0845 000 0000</p> '; $message .= '<p style="font-color:blue; font-weight:bold;">some tagline here</p> '; $message .= '<img src="imageurl/test.png" alt="sample alt tag"/>';  $message .= '</body></html>';   // let's sending  try {        $emailtext = "{$name} have been sent electronic document signed.\nto view document please click following link url: /www.domain.com";       mail($sendto, $subject, $emailtext, $message, $headers, "from: " . $from);      $responsearray = array('type' => 'success', 'message' => $okmessage); } catch (\exception $e) {     $responsearray = array('type' => 'danger', 'message' => $errormessage); }  if (!empty($_server['http_x_requested_with']) && strtolower($_server['http_x_requested_with']) == 'xmlhttprequest') {     $encoded = json_encode($responsearray);      header('content-type: application/json');      echo $encoded; } else {     echo $responsearray['message']; } 

i tested code , got warning: [18-aug-2017 12:44:15 africa/nairobi] php warning: mail() expects @ 5 parameters, 6 given in /home/ruemercc/public_html/lab/email2/mail.php on line 47

i suggest use phpmailer library found here phpmailer

. allow send bulk emails(which think added advantege in case). have fun coding


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -