PHP に組み込まれている mail() 関数では、App Engine Mail API を介してメールを送信できます。メールの送信に記載されている制限事項に従っている限り、ほとんどの既存のコードで正常に機能します。
または、Mail API を直接呼び出すこともできます。
use google\appengine\api\mail\Message;// Notice that $image_content_id is the optional Content-ID header value of the// attachment. Must be enclosed by angle brackets (<>)$image_content_id = '<image-content-id>';// Pull in the raw file data of the image file to attach it to the message.$image_data = file_get_contents('image.jpg');try { $message = new Message(); $message->setSender('from@example.com'); $message->addTo('to@example.com'); $message->setSubject('Example email'); $message->setTextBody('Hello, world!'); $message->addAttachment('image.jpg', $image_data, $image_content_id); $message->send(); echo 'Mail Sent';} catch (InvalidArgumentException $e) { echo 'There was an error';}
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["わかりにくい","hardToUnderstand","thumb-down"],["情報またはサンプルコードが不正確","incorrectInformationOrSampleCode","thumb-down"],["必要な情報 / サンプルがない","missingTheInformationSamplesINeed","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-03-06 UTC。"],[[["This guide outlines how to utilize the Mail API for sending and receiving emails within the context of App Engine, particularly for first-generation runtimes."],["PHP's built-in `mail()` function can send emails using the App Engine Mail API, and direct calls to the API are also possible using the `google\\appengine\\api\\mail\\Message` class."],["Before sending emails, you must register your sender email addresses as authorized senders, according to the Mail API's guidelines."],["To receive emails, enable incoming mail in your `app.yaml` file, create URL mappings for incoming email addresses, and implement handlers in your app's code to process the received mail using the Mailparse extension."],["Your app can receive incoming emails at addresses formatted as `anything@appid.appspotmail.com`, even if your app is deployed on a custom domain, as you cannot use custom domain addresses to receive emails."]]],[]]