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