У меня есть файл Excel и я пытаюсь отправить электронное письмо.Я могу успешно отправить электронное письмо, но я получаю сообщение об ошибке при открытии приложенного файла Excel, который указан ниже:
ошибка: -
"Excel cannot open the file "test.xlsx" because the file format or file extension is not valid.
Verify that the file has not been corrupted and that the file extension matches the format of the file."
Код: -
$WRKDIR="/tmp/xpyt/"
$EXCEL_FILE="test.xlsx"
$EMAIL_FROM="xxx@in.imk.com"
$EMAIL_TO="yyy@in.imk.com"
$EMAIL_SUBJECT="Excel Report"
$EMAIL_TYPE="multipart/mixed"
$msg = MIME::Lite->new(
From => $EMAIL_FROM,
To => $EMAIL_TO,
Subject => $EMAIL_SUBJECT,
Type => $EMAIL_TYPE,
);
$msg->attach(
Type => 'TEXT',
Data => "Here's the excel file you wanted"
);
chmod 0755, $EXCEL_FILE_PATH;
$msg->attach(
Type => 'application/vnd.ms-excel',
Path => $WRKDIR,
Filename => $EXCEL_FILE,
Disposition => 'attachment'
);
$msg->send();
Любая помощь будет оценена.