Closed alfonsobries closed 6 years ago
I think i closest to the solution, i found the Attachments() function in the Message class, it attach the files to the mail but currently sends empty files, (i made a few combinations but i cant achieve the attachment works)
any idea?
$oAttachment = \MailSo\Mime\Attachment::NewInstance(
$rResource = file_get_contents($full_path), // full path is the path of the file uploaded to the server
$sFileName = $attachment_name, // This is the file name, example: "my_file.pdf"
$iFileSize = filesize($full_path),
);
$oMessage->Attachments()->Add($oAttachment);
I think i achieved to solve the problem, instead using file_get_contents i use fopen to create a resource and it works great!
$oAttachment = \MailSo\Mime\Attachment::NewInstance(
fopen($full_path, 'r'),
$sFileName = $attachment_name,
$iFileSize = filesize($full_path)
);
$oMessage->Attachments()->Add($oAttachment);
Im tryiing to send an email with the php api according to this example: https://afterlogic.com/docs/webmail-pro/integration-and-development/sending-mail
Works fine for simple email but also i want to add attachments, i read the entirely documentation, and explore the source code but didnt find a function for add attachment to the message
Can you please help me?