Search code examples
phpphpmailermailer

PHPMailer - Use PHP rand(); feature in subject


How would I be able to use a random number php function in my subject using PHPMailer?

$mail->Subject = '*- Mailer Tester -*';

and I would like to add the following code into it,

rand();

note: I've already tried the easy solution of just adding it following the "*" but it just adds the text so in the email subject it would be like

*- Mailer Tester -* rand();

Solution

  • try

    $mail->Subject = '*- Mailer Tester -*'.rand();