Search code examples
phpemailphpmailer

Add a "counter" variable to send in mail() vía PHP


Alongside with the name, email, message, etc. I want to send a field that'll show up in my mailbox with an incremental number. For instance:

Name: Alex
Mail: alex@...
Message: Hi.
Email Number: 0001 (then 0002, 0003 and so on) <-- this is what I'm aiming to. Is it possible?


Solution

  • I didn't understand your question fully, but you might be looking for something familiar.

    $number=0001;
    $msg="Hi. "."Email Number: ". $number;
    mail('[email protected]', 'My Subject', $msg);