phpmailer noname attachment

本小妞迷上赌 提交于 2019-12-10 19:09:09

问题


I'm using phpmailer to send email. But all of my emails are send with noname attachement. I already checked if variables are set before I use addAttachemnt function and they are. It looks like this:

$fname = $_FILES['file']['name'];
$fTmpName = $_FILES['file']['tmp_name'];

            $mail = new PHPMailer();
            $mail->From = "mymail@mymail.com";  
            $mail->FromName = "mymail.com"; //moje meno 
            $mail->IsHTML(true);
            $mail->IsSMTP();
            $mail->Host = "smtp.mymail.com";
            $mail->Subject = "Subject";
            $mail->AddAddress($email);
            echo $fnameZivotopis;
            $mail->AddAttachment($fTmpName,$fname);
            $mail->Body = $msg;
            $mail->Send(); // send message

回答1:


Try to use AddStringAttachment(string $att_file_data, string $att_file_name, ...).



来源:https://stackoverflow.com/questions/12062939/phpmailer-noname-attachment

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!