Description:
How to send e-mails with attachments from a PHP script?
Solution:
The mail function of PHP supports also attachments. So, in creating the mail object we can add the attachment like this:
$to = ‘myname@mail.com’;
$subject = ‘Hello world with attachements’;
$attachment = chunk_split(base64_encode(file_get_contents(‘file_name.txt’)));
This is all, happy coding!