:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
import { HogFunctionTemplate } from '~/cdp/types'
export const template: HogFunctionTemplate = {
free: false,
status: 'hidden',
type: 'destination',
id: 'template-email',
name: 'Email',
description: 'Sends an email via PostHog email service',
icon_url: '/static/posthog-icon.svg',
category: ['Custom'],
code: `
let res := sendEmail(inputs.email)
if (not res.success) {
throw Error(f'Email failed to send: {res.error}')
}
`,
code_language: 'hog',
inputs_schema: [
{
type: 'native_email',
key: 'email',
label: 'Email message',
integration: 'email',
required: true,
default: {
to: {
email: '{{ person.properties.email }}',
name: '',
},
from: {},
replyTo: '',
cc: '',
bcc: '',
subject: '',
preheader: '',
text: '',
html: '',
},
secret: false,
description: 'The email message to send. Configure the recipient, sender, subject, and content.',
templating: 'liquid',
},
],
}