我使用php imagecreate创建了一个图像,我希望通过电子邮件发送它与PHPMailer,但我不明白我必须使用哪种方法以及如何
include 'Barcode39.php';
include 'PHPMailer.php';
$bar = new Barcode39('10127');
$bar->barcode_text_size = 10;
$bar->barcode_bar_thick = 10;
$bar->barcode_bar_thin = 5;
$bar_img = $bar->draw();
$bar_size[0] = imagesx($bar_img);
$bar_size[1] = imagesy($bar_img);
$im = imagecreatefromjpeg('biglietto.jpg');
imagecopymerge($im, $bar_img, 10, 9, 0, 0, $bar_size[0], $bar_size[1], 100);
$email = new PHPMailer();
$email->From = 'myemail@email.com';
$email->Body = 'my email';
$email->AddAddress( 'myemail@email.com' );
$email->addAttachment($im??);
答案 0 :(得分:0)
来自文档:
addAttachment(string $ path,string $ name ='',string $ encoding ='base64',string $ type ='',string $ disposition ='attachment'):boolean
只需为您的文件提供字符串路径,您就会很好。