Sử dụng hàm drupal_mail ()

Thí dụ đơn giản gửi một mail có nội dung HTML sử dụng hàm drupal_mail ()

<?php
  drupal_mail
(
    
'mail-test'// khóa, tiện để hệ thống theo dõi các mail gửi đi
    
'thehongtt@gmail.com'// gửi đến
    
'Tiêu đề email'// tiêu đề của email
    // Nội dung chúng ta gửi đi lúc này là một HTML table...
    
theme (
      
'table'
      array(
'Col1''Col2''Col3'), 
      array(
        array (
'1.1''1.2''1.3'),
        array (
'2.1''2.2''2.3'),
        array (
'3.1''3.2''32.3'),
      ), 
      array (
'style' => 'border: 1px #f00 dashed'),
      
'Nội dung của email'
    
),
    
// !-- nội dung email

    
null

   
// Header của email, cần xác định thuộc tính text/html ...
    
array (
      
'Content-type' => 'text/html; charset=UTF-8; format=flowed',
      
'From' => 'VNSupperMark Info <info@vnsuppermark.com>'
    
)
  );
?>

:-)

Thế Hồng,

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <sup> <br> <p> <h3>
  • Lines and paragraphs break automatically.
  • Link to content with [[some text]], where "some text" is the title of existing content or the title of a new piece of content to create. You can also link text to a different title by using [[link to this title|show this text]]. Link to outside URLs with [[http://www.example.com|some text]], or even [[http://www.example.com]].
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>. Beside the tag style "<foo>" it is also possible to use "[foo]". PHP source code can also be enclosed in <?php ... ?> or <% ... %>.

More information about formatting options

CAPTCHA
This question is used to make sure you are a human visitor and to prevent spam submissions.
Image CAPTCHA
Copy the characters (respecting upper/lower case) from the image.