Diagnostic reference
Missing required GmailApp arguments
Why GmailApp.createDraft reports 'Expected 3-4 arguments, but got 0', which arguments it needs, and how to fix the call before running the script.
Updated August 30, 2026
What myFunction reports
Expected 3-4 arguments, but got 0.
What it means
GmailApp.createDraft needs a recipient, a subject, and a body. Apps Script cannot create the draft without them. myFunction reports the incomplete call while the code is still an unsaved change in the editor.
Before and after
The code before and after the fix.
function createWelcomeDraft() {
GmailApp.createDraft();
}function createWelcomeDraft() {
GmailApp.createDraft(
'person@example.com',
'Welcome',
'Thanks for joining us.',
);
}What myFunction does
- Adds example values for the required recipient, subject, and body positions.
- Uses the existing GmailApp.createDraft overload.
Check before you apply
- Replace every example value with the real recipient and message content.
- Review the recipient before saving or running the script.
- myFunction does not create or send the draft, and it does not authorize Gmail access.
Related reading