Skip to main content
RapidDev - Software Development Agency
outsystems-tutorial

Email Setup in OutSystems: SMTP Configuration, Templates, and Attachments

Configure SMTP in Service Center → Administration → Email → Outgoing Email Settings. Create Email screens in Interface tab with dynamic expressions for content. Call Send_Email from a Server Action, passing the email screen name and input parameters. Attach files by populating the Attachments input with a list of EmailAttachment structures containing Binary Data.

What you'll learn

  • Configuring SMTP settings in Service Center for O11 (and the ODC equivalent)
  • Creating Email screens in the Interface tab with dynamic content expressions
  • Sending emails via the Send_Email Server Action with input parameter mapping
  • Attaching binary files to outgoing emails using the EmailAttachment structure
  • Testing email delivery and reading logs in Service Center
Book a free consultation
4.9Clutch rating
600+Happy partners
17+Countries served
190+Team members
Intermediate8 min read30-40 minOutSystems 11 and ODCMarch 2026RapidDev Engineering Team
TL;DR

Configure SMTP in Service Center → Administration → Email → Outgoing Email Settings. Create Email screens in Interface tab with dynamic expressions for content. Call Send_Email from a Server Action, passing the email screen name and input parameters. Attach files by populating the Attachments input with a list of EmailAttachment structures containing Binary Data.

Email in OutSystems: SMTP to Template to Send

OutSystems treats email as a first-class feature: Email screens are designed like web screens but rendered to HTML email, SMTP is configured once per environment, and sending is a single Server Action call. This tutorial covers the full flow from SMTP setup to a dynamic welcome email with a PDF attachment, tested end-to-end.

Prerequisites

  • An OutSystems 11 environment with Service Center admin access, or an ODC environment
  • SMTP server credentials (host, port, username, password) — use a service like SendGrid, Mailgun, or your corporate email server
  • Service Studio with a Reactive Web App open

Step-by-step guide

1

Configure SMTP in Service Center (O11)

Navigate to Service Center (environment-url/ServiceCenter). Login as an administrator. Path: Administration → Email → Outgoing Email Settings. Fill in: - Server name (SMTP host): e.g., smtp.sendgrid.net - Port: 587 (STARTTLS) or 465 (SSL/TLS) - Enable TLS/SSL: Yes - Username: your SMTP username - Password: your SMTP password - Test connection → Save For Gmail SMTP: use smtp.gmail.com, port 587, enable 'Less secure app access' or use App Passwords. For SendGrid: Server = smtp.sendgrid.net, Port = 587, Username = 'apikey', Password = your SendGrid API key. After saving, the SMTP settings apply to ALL modules in this environment. Different environments (Dev, QA, Prod) can have different SMTP settings.

Expected result: The Test Connection button returns 'Connection successful'. Email sending is now available for all modules in this environment.

2

Create an Email screen in the Interface tab

Email screens in OutSystems are specialized screens designed to produce HTML email content. They support Expression widgets with dynamic data and OutSystems UI email layout blocks. In Service Studio: Interface tab → Email (email-specific UI flow, separate from your regular UI flows). Right-click → 'Add Email'. Name it 'WelcomeEmail'. Add input parameters to the Email: right-click WelcomeEmail → Add Input Parameter: - UserName: Text - ActivationLink: Text Design the email body in the Screen Editor. Use: - Text widgets for static content - Expression widgets for dynamic content: UserName, ActivationLink - The built-in email layout that provides a basic header/body/footer structure Example email body: 'Hello [Expression: UserName],' + newline + 'Welcome to our platform. Click here to activate your account: [Link: ActivationLink]'

Expected result: WelcomeEmail screen appears in Interface tab → Email with two input parameters and designed content visible in the Screen Editor.

3

Send the email from a Server Action

The Send_Email action is a built-in system action in Logic tab → System → Email. Create or open the Server Action where you want to send the email (e.g., 'RegisterUser' Server Action). After the user registration logic: Drag Send_Email from Logic tab → System → Email into the action flow. Send_Email input parameters: - From: 'noreply@yourapp.com' (or a Site Property: Site.SenderEmail) - To: UserEmail - Subject: 'Welcome to Our Platform — Please Activate Your Account' - Bcc: '' (optional) - Cc: '' (optional) - [Email Screen]: WelcomeEmail (select from dropdown) - UserName: NewUser.Name - ActivationLink: ActivationURL The email screen input parameters are mapped directly in the Send_Email call node. The platform renders the email screen to HTML and sends it.

typescript
1/* Send_Email action parameters */
2From: "noreply@yourapp.com"
3To: NewUser.Email
4Subject: "Welcome to Our Platform"
5CC: ""
6BCC: ""
7Email: WelcomeEmail
8 UserName: NewUser.Name
9 ActivationLink: ActivationURL
10
11/* Full Server Action flow */
12Start
13 --> CreateUser: (user registration logic)
14 --> Assign: ActivationURL = BaseURL + "/activate?token=" + ActivationToken
15 --> Send_Email: (parameters above)
16 --> End

Expected result: After completing user registration, the welcome email is sent to the user's email address. Check Service Center → Monitoring → Email for delivery status.

4

Add a file attachment to the email

Send_Email accepts an Attachments input parameter — a list of EmailAttachment structures. EmailAttachment structure (from System library): - FileContent: Binary Data (the file content) - FileName: Text (the filename shown in the email) - MimeType: Text (e.g. 'application/pdf') To attach a PDF invoice: 1. Create Local Variable 'EmailAttachments' of type EmailAttachment List 2. Create Local Variable 'Attachment' of type EmailAttachment 3. Assign: Attachment.FileContent = InvoicePDF, Attachment.FileName = 'Invoice.pdf', Attachment.MimeType = 'application/pdf' 4. Call ListAppend(EmailAttachments, Attachment) — drag ListAppend from Toolbox → Built-in Functions → List 5. In Send_Email, set Attachments = EmailAttachments

typescript
1/* Building attachments list */
2Assign:
3 Attachment.FileContent = InvoicePDFContent /* Binary Data */
4 Attachment.FileName = "Invoice_" + IntegerToText(InvoiceNumber) + ".pdf"
5 Attachment.MimeType = "application/pdf"
6
7ListAppend(EmailAttachments, Attachment)
8
9/* Send_Email with attachments */
10Send_Email:
11 From: Site.SenderEmail
12 To: Customer.Email
13 Subject: "Your Invoice #" + IntegerToText(InvoiceNumber)
14 Email: InvoiceEmail (email screen)
15 Attachments: EmailAttachments

Expected result: The recipient receives the email with the PDF invoice attached and visible in their email client.

5

Monitor email delivery in Service Center

After sending emails, check delivery status in Service Center. Path: Monitoring → Email. You see a log of all sent emails with: - Sent timestamp - From, To addresses - Subject - Status: Sent, Error, Queued - Error details if delivery failed Common delivery errors: - 'Authentication failed' — wrong SMTP username/password, or app passwords required - 'Connection refused' — wrong port, firewall blocking outgoing SMTP, or STARTTLS/SSL mismatch - 'Recipient address rejected' — the To address is invalid or the recipient server blocked it - 'Relay access denied' — your SMTP server requires authentication for the From address In Service Center: Factory → Modules → [Module] → scroll to find Pending Emails — emails are queued and sent by OutSystems asynchronously. If a module has pending emails that are not being sent, check the SMTP configuration.

Expected result: Service Center → Monitoring → Email shows the sent email with Status = Sent. If there is an error, the error message provides diagnostic information.

Complete working example

SendEmail_withAttachment.txt
1/* ============================================================
2 EMAIL SCREEN: WelcomeEmail (Interface tab Email)
3 Input Parameters: UserName (Text), ActivationLink (Text)
4 Content: HTML template with Expression widgets
5 ============================================================ */
6
7/* ============================================================
8 SERVER ACTION: SendWelcomeEmail
9 Input: UserEmail (Text), UserName (Text), ActivationToken (Text)
10 ============================================================ */
11Start
12 --> Assign:
13 BaseURL = Site.AppBaseURL
14 ActivationURL = BaseURL + "/activate?token=" + ActivationToken
15 --> Send_Email:
16 From: Site.SenderEmail
17 To: UserEmail
18 Subject: "Welcome to Our Platform — Please Activate Your Account"
19 Email: WelcomeEmail
20 UserName: UserName
21 ActivationLink: ActivationURL
22 --> End
23
24Exception Handler (AllExceptions)
25 --> LogError:
26 ModuleName = "AuthModule"
27 Source = "SendWelcomeEmail"
28 Message = "Email send failed to " + UserEmail + ": " + ExceptionMessage
29 --> End /* Don't block registration if email fails */
30
31/* ============================================================
32 SERVER ACTION: SendInvoiceEmail (with attachment)
33 Input: CustomerId (Customer Identifier), InvoiceId (Invoice Identifier)
34 ============================================================ */
35Start
36 --> GetCustomer: Id = CustomerId
37 --> GenerateInvoicePDF: InvoiceId = InvoiceId /* See pdf-generation tutorial */
38 --> Assign:
39 Attachment.FileContent = GenerateInvoicePDF.PDFContent
40 Attachment.FileName = "Invoice_" + IntegerToText(InvoiceId) + ".pdf"
41 Attachment.MimeType = "application/pdf"
42 --> ListAppend(EmailAttachments, Attachment)
43 --> Send_Email:
44 From: Site.SenderEmail
45 To: GetCustomer.Customer.Email
46 Subject: "Your Invoice #" + IntegerToText(InvoiceId)
47 Email: InvoiceEmail (screen)
48 Attachments: EmailAttachments
49 --> End

Common mistakes

Why it's a problem: Calling Send_Email from a Client Action

How to avoid: Send_Email is a system Server Action — it must be called from a Server Action (or Data Action). Move email sending logic to a Server Action and call it from the Client Action.

Why it's a problem: Not handling the exception when Send_Email fails, causing the entire transaction to roll back

How to avoid: Add an exception handler after Send_Email in the Server Action. For critical operations (user registration, order placement), the email failure should be logged but not abort the main transaction.

Why it's a problem: Using CurrDateTime() in the email subject without formatting, which produces the internal DateTime representation

How to avoid: Use FormatDate(CurrDate(), 'dd/MM/yyyy') for readable dates in email subjects and bodies. CurrDateTime() without FormatDate() produces a machine-format string.

Why it's a problem: Hardcoding the From address which bounces in production because the SMTP server requires a verified sender domain

How to avoid: Use a Site Property for the From address and ensure the address matches a verified domain in your SMTP provider (SendGrid, Mailgun, etc.). Unverified sender addresses cause SPF/DKIM failures and emails go to spam.

Best practices

  • Store the sender email address as a Site Property (Site.SenderEmail) rather than hard-coding it — this lets you change it per environment without redeploying.
  • Wrap Send_Email in an exception handler — a failed email should not roll back a successful user registration or order. Log the error and continue.
  • Test your email screen with real email clients (Gmail, Outlook, Apple Mail) before going to production. Rendering differs significantly between clients.
  • Use BCC to a monitoring address in production to verify email delivery without modifying recipients.
  • For bulk emails (newsletters, batch digests), use a Timer to send in batches rather than calling Send_Email thousands of times in a single Server Action.
  • Always include a plain-text alternative in the email (OutSystems email screens support this via the AlternativePlainText property) for clients that don't render HTML.

Still stuck?

Copy one of these prompts to get a personalized, step-by-step explanation.

ChatGPT Prompt

Explain OutSystems email setup from SMTP configuration to sending. I need to: (1) configure SMTP in Service Center for SendGrid (smtp.sendgrid.net, port 587, API key as password), (2) create a WelcomeEmail Email screen in the Interface tab with UserName and ActivationLink input parameters, (3) call Send_Email from a Server Action with From=Site.SenderEmail, pass input parameters to the email screen, (4) add an AllExceptions handler that logs but doesn't abort the transaction. Use OutSystems Server Action flow notation.

OutSystems Prompt

Create an OutSystems email sending setup. Build: (1) WelcomeEmail screen in Interface tab → Email with UserName (Text) and ActivationLink (Text) inputs. (2) SendWelcomeEmail Server Action with UserEmail (Text), UserName (Text), ActivationToken (Text) inputs that builds ActivationURL from Site.AppBaseURL and calls Send_Email with from=Site.SenderEmail, to=UserEmail, subject='Welcome to Our Platform'. (3) AllExceptions handler with LogError that does NOT re-raise so registration proceeds even if email fails.

Frequently asked questions

How do I send emails in OutSystems without using the platform SMTP configuration?

Use a REST API integration with an email service provider (SendGrid, Mailgun, Postmark). Create a Consume REST API in Logic tab → Integrations → REST and call the provider's send email endpoint from a Server Action. This bypasses the Service Center SMTP settings entirely and gives you more delivery control, bounce tracking, and analytics.

Why is my email going to spam even though it sends successfully?

Successful delivery to the recipient's mail server does not guarantee inbox placement. Common spam causes: missing SPF record for your From domain, missing DKIM signature (configure in your SMTP provider), sending from a shared IP with poor reputation, or email content containing spam trigger words. Configure SPF and DKIM for your sender domain in your DNS provider.

Can I send HTML emails without using an Email screen?

Yes. Send_Email has an HTML body parameter where you can pass raw HTML as a Text variable. This is useful for simple templated emails where building a full Email screen is overhead. For dynamic content, build the HTML string in an Assign node using string concatenation. For complex templates, the Email screen approach is more maintainable.

How does email sending work differently in ODC compared to O11?

In O11, email is configured once in Service Center (shared SMTP for the entire environment) and uses the built-in Send_Email action. In ODC, there is no built-in SMTP panel — you must either configure an SMTP connector as a Secret Setting or use a Forge component (SendGrid Connector, Mailgun Connector) that calls the email provider's API directly. The ODC approach gives more flexibility but requires more initial setup.

RapidDev

Talk to an Expert

Our team has built 600+ apps. Get personalized help with your project.

Book a free consultation

Need help with your project?

Our experts have built 600+ apps and can accelerate your development. Book a free consultation — no strings attached.

Book a free consultation

We put the rapid in RapidDev

Need a dedicated strategic tech and growth partner? Discover what RapidDev can do for your business! Book a call with our team to schedule a free, no-obligation consultation. We'll discuss your project and provide a custom quote at no cost.