Remote PHPMailer AddAttachment File

$remote_path = 'http://bucket.s3.amazonaws.com/whatever.txt'; $mail->AddAttachment($remote_path); 

This does not work because PHPMailer wants local file or binary data. He also tried this:

 $data = file_get_contents($remote_path); $mail->AddAttachment($data); 

I do not want to upload it to a local file if I do not need it. Why is the file_get_contents version not working? Is this string, not binary data?

Edit: I get no errors.

+2
source share
1 answer

You should take a look at an alternative phpmailer function called AddStringAttachment:

AddStringAttachment($string, $filename, $encoding = 'base64', $type = 'application/octet-stream')

http://phpmailer.worxware.com/index.php?pg=tutorial#3.2

+7
source

Source: https://habr.com/ru/post/949587/


All Articles