> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # SendTest # Package: emailMarketing # Namespace: CampaignService # Method link: https://dev.wix.com/docs/api-reference/business-management/marketing/emails/email-marketing/campaign/send-test.md ## Permission Scopes: Manage Email Marketing: SCOPE.DC-PROMOTE.EMAIL-MARKETING ## Introduction Sends a test email. Call this method to preview your email campaign. We strongly recommend calling this method only a few times in a row, as there is a rate limit to prevent abuse of the Send Test method. --- ## REST API ### Schema ``` Method: sendTest Description: Sends a test email. Call this method to preview your email campaign. We strongly recommend calling this method only a few times in a row, as there is a rate limit to prevent abuse of the Send Test method. URL: https://www.wixapis.com/email-marketing/v1/campaigns/{campaignId}/test Method: POST # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: toEmailAddress Method parameters: param name: emailSubject | type: emailSubject | description: Email subject. param name: toEmailAddress | type: toEmailAddress | description: Recipient email address. | required: true Return type: SendTestResponse EMPTY-OBJECT {} ``` ### Examples ### Send Test ```curl curl -X POST 'https://www.wixapis.com/email-marketing/v1/campaigns/98b5a0b3-549b-4e58-b933-a8bd40923a14/test' \ -H 'Authorization: ' -H 'Content-Type: application/json' \ -d '{ "emailSubject": "Yoga with puppies", "toEmailAddress": "yoga@example.com" }' \ ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.emailMarketing.CampaignService.sendTest(campaignId, options) Description: Sends a test email. Call this method to preview your email campaign. We strongly recommend calling this method only a few times in a row, as there is a rate limit to prevent abuse of the Send Test method. # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: campaignId, options.toEmailAddress, options Method parameters: param name: campaignId | type: string | description: Campaign GUID. | required: true param name: options | type: SendTestOptions none | required: true - name: emailSubject | type: string | description: Email subject. - name: toEmailAddress | type: string | description: Recipient email address. | required: true Return type: PROMISE EMPTY-OBJECT {} ``` ### Examples ### Sends a test email campaign for preview purposes (with elevated permissions) ```javascript import { campaigns } from '@wix/email-marketing'; import { auth } from '@wix/essentials'; const elevatedSendTest = auth.elevate(campaigns.sendTest); // Sample campaignId = "ea46013c-bbbf-4617-ad5d-9247bc4c0970"; // Sample options value: // { // "emailSubject": "Hello", // "toEmailAddress": "clientname@email.com", // "language": "en", // "placeholders": {}, // "fromName": "User", // "replyToEmailAddress": "yourname@wix.com" // } export async function mySendTestFunction(campaignId, options) { try { const result = await elevatedSendTest(campaignId, options); console.log("Success! Your test campaign has been sent.") // return result; } catch (error) { console.error(error); } } /* Promise returns void */ ``` ### Sends a test email campaign for preview purposes ```javascript import { campaigns } from '@wix/email-marketing'; // Sample campaignId = "ea46013c-bbbf-4617-ad5d-9247bc4c0970"; // Sample options value: // { // "emailSubject": "Hello", // "toEmailAddress": "clientname@email.com", // "language": "en", // "placeholders": {}, // "fromName": "User", // "replyToEmailAddress": "yourname@wix.com" // } export async function mySendTestFunction(campaignId, options) { try { const result = await campaigns.sendTest(campaignId, options); console.log("Success! Your test campaign has been sent.") // return result; } catch (error) { console.error(error); } } /* Promise returns void */ ``` ### sendTest (self-hosted) Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md). ```javascript import { createClient } from '@wix/sdk'; import { campaigns } from '@wix/email-marketing'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { campaigns }, // Include the auth strategy and host as relevant }); async function sendTest(campaignId,options) { const response = await myWixClient.campaigns.sendTest(campaignId,options); }; ``` ---