1

xlsx と pdf でファイルを作成する必要があり、電子メールに添付して送信したい (どこにも保存したくない) 保存したファイルを添付して電子メールで送信する方法を知っています。どうすれば保存せずに直接送信できますか.hereは私が試したものです

$attachment = @chunk_split(base64_encode(file_get_contents($path)));
 $message .= "--PHP-mixed-$random_hash\r\n"
  ."Content-Type: application/doc; name=\"$file\"\r\n"
  ."Content-Type: application/pdf; name=\"$file\"\r\n"
  ."Content-Type: application/docx; name=\"$file\"\r\n"
  ."Content-Transfer-Encoding: base64\r\n"
  ."Content-Disposition: attachment\r\n\r\n";
  $message .= $attachment;
  $message .= "/r/n--PHP-mixed-$random_hash--";

  //send the email
 $mail = mail( $to, $subject , $message, $headers );

$path がありません。同じファイルにコンテンツを生成しています。保存せずに送信するにはどうすればよいですか?

4

1 に答える 1