HTML markup and styling can make an email more attractive. We can send simple text mail by using PHP's mail function. But what about HTML formatted mail! Can we send HTML formatted mail same way? The answer is YES! But we need to add some header information (including content type) for this. Here an simple example for sending HTML mail using PHP.
The htmlMail function:
Usage:
The htmlMail function:
/** * HTML Mail function * * @return bool | void **/ function htmlMail($to, $from_mail, $from_name, $subject, $message) { $header = array(); $header[] = "MIME-Version: 1.0"; $header[] = "From: {$from_name}<{$from_mail}>"; /* Set message content type HTML*/ $header[] = "Content-type:text/html; charset=iso-8859-1"; $header[] = "Content-Transfer-Encoding: 7bit"; if( mail($to, $subject, $message, implode("\r\n", $header)) ){ return true; } }
Usage:
/* HTML Formatted Message */ $msg = "<html>\n<head>\n<title>Testing</title>\n</head>\n<body>\n"; $msg .= "<h1 style='color:red;'> Hello Horld! </h1>\n</body>\n</html>"; /* Send mail */ if ( htmlMail('to@mail.com', 'from@mail.com', 'My Name', 'Mail Subject', $msg) ){ echo "Mail Send!"; } else{ echo "Mail Could not send!" }
dịch vụ kế toán thuế tại cầu giấy
ReplyDeletedịch vụ kế toán thuế tại thanh xuân
dịch vụ kế toán thuế tại hà đông
dịch vụ kế toán thuế tại long biên
dịch vụ kế toán thuế tại tphcm
dịch vụ kế toán thuế tại bắc ninh
dịch vụ kế toán thuế tại đống đa
dịch vụ kế toán thuế tại tây hồ
dịch vụ kế toán thuế tại ba đình
dịch vụ kế toán thuế tại từ liêm
dịch vụ kế toán thuế tại hai bà trưng
dịch vụ kế toán thuế tại hoàng mai
dịch vụ kế toán thuế tại thanh trì
dịch vụ kế toán thuế tại quận 3
dịch vụ kế toán thuế tại quận thủ đức
dịch vụ kế toán thuế tại quận bình thạnh
dịch vụ kế toán thuế tại quận tân phú
dịch vụ kế toán thuế tại quận 12
dịch vụ kế toán thuế tại quận 11
dịch vụ kế toán thuế tại quận 10
dịch vụ kế toán thuế tại quận 9
dịch vụ kế toán thuế tại quận 8
dịch vụ kế toán thuế tại quận 7
dịch vụ kế toán thuế tại quận 6
dịch vụ kế toán thuế tại quận 5
dịch vụ kế toán thuế tại quận 4
dịch vụ kế toán thuế tại thái bình
I have read your blog its very attractive and impressive. I like it your blog.
ReplyDeletePHP Training in chennai | PHP Training Course
PHP Training in chennai | Online PHP Course
Himachal Pradesh University BA Part 2 Result
ReplyDeleteHimachal Pradesh University BA Part 3 Result