Attachment file show version in mail using phpmailer

To show the version of an attachment file in an email using PHPMailer, you can use the $mail->AddAttachment() method and specify the attachment name with the version number included.

Here's an example:

<?php
require_once 'PHPMailer/PHPMailer.php';
require_once 'PHPMailer/SMTP.php';
require_once 'PHPMailer/Exception.php';

$mail = new PHPMailer\PHPMailer\PHPMailer();

// Set your email settings here...

// Add attachment with version number
$attachment = 'example_file_v1.2.zip';
$mail->AddAttachment($attachment, 'example_file.zip', 'application/zip', 'Example File v1.2');

// Set the email content...
$mail->Body = 'This is the email body...';

// Send the email...
$mail->send();

In this example, the attachment name is set to example_file_v1.2.zip, but when the attachment is sent, the actual file name will be example_file.zip. The AddAttachment() method takes four parameters:

  1. The path to the attachment file.
  2. The name of the attachment file (which will be displayed in the email).
  3. The MIME type of the attachment file.
  4. The description of the attachment file (which will be displayed in the email).

By specifying the version number in the attachment name, you can include the version number in the email without having to modify the actual file name.

Note that the version number is only included in the attachment name, not in the file name itself. If you need to include the version number in the file name, you'll need to modify the file name before sending the email.