当我尝试使用 php.text 发送邮件时,也将其作为名称为 noname.html 的附件发送。请为我提供解决方案。我已经使用这个库发送电子邮件https://github.com/google/google-api-php-client。我的代码是这样的。任何帮助将不胜感激。
$client->setAccessToken($_SESSION['gmail_access_token']);
$objGMail = new Google_Service_Gmail($client);
$strMailContent = 'This is a test mail which is <b>sent via</b> using Gmail API client library.<br/><br/><br/>Thanks,<br/><b>Premjith K.K..</b>';
// $strMailTextVersion = strip_tags($strMailContent, '');
$strRawMessage = "";
$boundary = uniqid(rand(), true);
$subjectCharset = $charset = 'utf-8';
$strToMailName = 'NAME';
$strToMail = 'name@gmail.com';
$strSesFromName = 'Premjith GMAIL API';
$strSesFromEmail = 'premji341800@gmail.com';
$strSubject = 'Test mail using GMail API - with attachment - ' . date('M d, Y h:i:s A');
$strRawMessage .= …Run Code Online (Sandbox Code Playgroud)