1import{j as e}from"./DJx4IWN9.js";const s={path:"/docs/scheduled-email-delivery/",title:"Scheduled email delivery"};function i(n){const r={a:"a",code:"code",h1:"h1",h2:"h2",p:"p",pre:"pre",...n.components},{MultiLanguageCodeBlock:a,MultiLanguageCodeBlockItem:t}=r;return a||l("MultiLanguageCodeBlock"),t||l("MultiLanguageCodeBlockItem"),e.jsxs(e.Fragment,{children:[e.jsx(r.h1,{children:"Scheduled email delivery"}),` 2`,e.jsxs(r.p,{children:["Schedule a delivery of an email by providing the ",e.jsx(r.code,{children:"scheduledAt"})," parameter set to a valid ",e.jsx(r.a,{href:"https://en.wikipedia.org/wiki/ISO_8601",children:"ISO 8601"})," date in the future."]}),` 3`,e.jsxs(r.p,{children:[e.jsx(r.code,{children:"scheduledAt"})," must be in the future and no more than 30 days from now."]}),` 4`,e.jsx(r.h2,{children:"Example"}),` 5`,e.jsxs(a,{children:[e.jsx(t,{language:"javascript",children:e.jsx(r.pre,{children:e.jsx(r.code,{className:"language-js",children:`const configureSidemail = require("sidemail");\r 6const sidemail = configureSidemail({ apiKey: "replace-with-your-api-key" });\r 7\r 8const response = await sidemail.sendEmail({\r 9 toAddress: "[email protected]",\r 10 fromAddress: "[email protected]",\r 11 fromName: "Your app",\r 12 templateName: "Welcome",\r 13 // Deliver the email in 60 minutes from now\r 14 scheduledAt: new Date(Date.now() + 60 * 60000).toISOString(),\r 15}); 16`})})}),e.jsx(t,{language:"ruby",children:e.jsx(r.pre,{children:e.jsx(r.code,{className:"language-ruby",children:`require "sidemail"\r 17require "date"\r 18\r 19sm = Sidemail.new(api_key: "replace-with-your-api-key")\r 20\r 21# Deliver the email in 60 minutes from now\r 22scheduled_at = (Time.now + 60 * 60).utc.iso8601\r 23\r 24response = sm.send_email(\r 25 toAddress: "[email protected]",\r 26 fromAddress: "[email protected]",\r 27 fromName: "Your app",\r 28 templateName: "Welcome",\r 29 scheduledAt: scheduled_at\r 30) 31`})})}),e.jsx(t,{language:"php",children:e.jsx(r.pre,{children:e.jsx(r.code,{className:"language-php",children:`$sm = new Sidemail\\Sidemail(apiKey: 'replace-with-your-api-key');\r 32\r 33$response = $sm->sendEmail([\r 34 'toAddress' => '[email protected]',\r 35 'fromAddress' => '[email protected]',\r 36 'fromName' => 'Your app',\r 37 'templateName' => 'Welcome',\r 38 // Deliver the email in 60 minutes from now\r 39 'scheduledAt' => gmdate('c', time() + 60 * 60),\r 40]); 41`})})}),e.jsx(t,{language:"python",children:e.jsx(r.pre,{children:e.jsx(r.code,{className:"language-python",children:`from sidemail import Sidemail\r 42import datetime\r 43\r 44sm = Sidemail(api_key="replace-with-your-api-key")\r 45scheduled_at = (datetime.datetime.utcnow() + datetime.timedelta(minutes=60))\r 46scheduled_at_iso = scheduled_at.replace(microsecond=0).isoformat() + "Z"\r 47\r 48resp = sm.send_email(\r 49 toAddress="[email protected]",\r 50 fromAddress="[email protected]",\r
51 fromName="Your app",\r 52 templateName="Welcome",\r 53 scheduledAt=scheduled_at_iso,\r 54) 55`})})}),e.jsx(t,{language:"curl",children:e.jsx(r.pre,{children:e.jsx(r.code,{className:"language-bash",children:`curl -X POST https://api.sidemail.io/v1/emails \\\r 56 -H "Content-Type: application/json" \\\r 57 -H "Authorization: Bearer replace-with-your-api-key" \\\r 58 -d '{\r 59 "toAddress": "[email protected]",\r 60 "fromAddress": "[email protected]",\r 61 "fromName": "Your app",\r 62 "templateName": "Welcome",\r 63 "scheduledAt": "2026-10-01T12:00:00Z" 64 }' 65`})})})]}),` 66`,e.jsx(r.h2,{children:"Unschedule email"}),` 67`,e.jsxs(r.p,{children:["Unschedule email delivery by deleting the email via API (",e.jsx(r.a,{href:"/docs/api/email/#delete-email",children:"see the delete email API endpoint"}),")."]}),` 68`,e.jsx(r.p,{children:"Or unschedule email deliver from the project's history page in your dashboard."})]})}function o(n={}){const{wrapper:r}=n.components||{};return r?e.jsx(r,{...n,children:e.jsx(i,{...n})}):i(n)}function l(n,r){throw new Error("Expected component `"+n+"` to be defined: you likely forgot to import, pass, or provide it.")}export{o as default,s as meta};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.