Check and if necessary fix the file name of an attachment so that the attached file
has the same extension as the source file, and not a different file extension
Parameters
string$file Path to the file to be attached
string$name The file name to be used for the attachment