HTML tags when sending email

HTML tags when sending email

jdarvillejdarville Posts: 1Questions: 1Answers: 0
edited February 2017 in Free community support

Greetings,
Whenever a user edits a record, i'm sending an email to a distribution group which shows the values. I'm trying to wrap the values in an html tag so its easier to read on the email. I tried the following but it prints the html tag instead:

Editor::inst( $db, 'parts' )
    ->fields(
        Field::inst( 'firstname' )->validator( 'Validate::notEmpty' ),
        Field::inst( 'lastname' )->validator( 'Validate::notEmpty' ),
        Field::inst( 'status' ),
        Field::inst( 'email' ),
        Field::inst( 'company' ),
        Field::inst( 'tag' ),
        Field::inst( 'serialnumber' ),
        Field::inst( 'requestpartnumber' ),
        Field::inst( 'requestpartquantity' ),
        Field::inst( 'updated_date' )
            ->validator( 'Validate::dateFormat', array(
                'empty' => false,
                'format' => 'm-d-Y g:i A'
            ) )
            ->getFormatter( 'Format::datetime', array(
                'from' => 'Y-m-d H:i:s',
                'to' =>   'm-d-Y g:i A'
            ) )
            ->setFormatter( 'Format::datetime', array(
                'from' => 'm-d-Y g:i A',
                'to' =>   'Y-m-d H:i:s'
            ) )
    
    )

    ->on( 'postEdit', function ( $editor, $id, $values, $row) {

    mail( me@gmail.com', 'Parts ETA', ''.implode('<br>', $values).'' );
} )
    ->process( $_POST )
    ->json();

Any idea's how to add an HTML header?

Answers

  • allanallan Posts: 63,230Questions: 1Answers: 10,417 Site admin

    You'd probably have to use something more complex than PHP's built in mail() method. The PHPMailer class is a popular one for example.

    Allan

This discussion has been closed.