<@U04UQ68083H> whenever I create a user in Ory Net...
# ory-copilot
f
@chilly-king-10285 whenever I create a user in Ory Network, I want an email to be sent automatically with the login instructions. Is this possible?
b
A message from kapa.ai
Yes, you can automatically send an email with login instructions when a user is created in Ory Network by using Ory Actions and webhooks. This can be accomplished in a few different ways: ### Using Mailchimp Integration You can set up a webhook that triggers after user registration to send a transactional email through Mailchimp: 1. Configure Mailchimp Transactional Email (Mandrill) with your domain 2. Create a Mandrill API key 3. Set up an Ory Action that triggers after registration to send the welcome email with login instructions [Mailchimp integration with Ory Actions](https://www.ory.sh/docs/actions/integrations/mailchimp) provides detailed steps for this integration. ### Using Custom Webhooks Alternatively, you can create a custom webhook that triggers after user registration: 1. Navigate to AuthenticationActions & Webhooks in the [Ory Console](https://console.ory.sh/projects/current/developers/actions) 2. Click on + Create new Action 3. Choose the registration flow and set it to trigger "after" registration 4. Configure the webhook with your email service endpoint [Integrate with Ory Cloud through webhooks](https://www.ory.sh/docs/guides/integrate-with-ory-cloud-through-webhooks) provides more details on setting up webhooks. ### Customizing Email Templates You can also customize the email templates that Ory sends: 1. Ory has built-in templates for various messages including registration 2. You can replace the default templates with custom ones that include login instructions [Email templates](https://www.ory.sh/docs/kratos/emails-sms/custom-email-templates) documentation explains how to customize these templates. For the best user experience, you might want to enable auto-login on registration, which automatically creates a session after registration. This way, users don't need to log in immediately after registering, and your welcome email can focus on next steps rather than immediate login instructions. [User registration with auto-login](https://www.ory.sh/docs/kratos/self-service/flows/user-registration#with-auto-login-on-registration-2) provides information on this feature.
f
@chilly-king-10285 how to send via AWS SES?
b
A message from kapa.ai
To send emails from Ory using AWS SES (Simple Email Service), you can configure Ory to use AWS SES as your SMTP provider. Here's how to set it up: ## Configure AWS SES SMTP with Ory You can use AWS SES SMTP with Ory by setting the appropriate SMTP connection URI in your configuration:
Copy code
smtp://{smtp-user}:{smtp-password}@email-smtp.{region}.<http://amazonaws.com:587/|amazonaws.com:587/>
For example:
Copy code
<smtp://theuser:thepassword@email-smtp.us-east-1.amazonaws.com:587/>
Note that the username and password must be [URI encoded](https://en.wikipedia.org/wiki/Percent-encoding). [Send emails using your SMTP server](https://www.ory.sh/docs/kratos/emails-sms/sending-emails-smtp#smtp-integrations) provides this information along with examples for other SMTP providers. ## Implementation Steps 1. First, set up AWS SES in your AWS account and create SMTP credentials 2. Verify your email domain in AWS SES 3. Configure Ory to use AWS SES by updating your SMTP settings: - In Ory Console: Go to Email and SMS settings and update the SMTP configuration - Using Ory CLI: Update your identity configuration with the AWS SES SMTP connection URI This will enable Ory to send all system emails (verification, recovery, login codes, etc.) through your AWS SES account. For custom email templates, you can also [customize the email templates](https://www.ory.sh/docs/kratos/emails-sms/custom-email-templates#using-custom-message-templates) that Ory sends through AWS SES to match your branding and requirements.
f
@chilly-king-10285 I've configured the SMTP settings. How to trigger now sending the email after user registration?
b
A message from kapa.ai
Now that you've configured your SMTP settings, you need to set up an action that triggers after user registration to send your welcome email. Here's how to do it: ## Set Up a Post-Registration Action You can use Ory Actions to trigger an email after user registration: 1. Navigate to AuthenticationActions & Webhooks in the [Ory Console](https://console.ory.sh/projects/current/developers/actions) 2. Click on + Create new Action 3. Choose the registration flow and set it to trigger "after" registration 4. Configure your webhook details including URL, method, and authentication [Trigger custom logic and integrate with external systems with webhooks](https://www.ory.sh/docs/guides/integrate-with-ory-cloud-through-webhooks) provides detailed guidance on setting up these actions. ## Options for Sending the Email You have several options for the actual email sending mechanism: ### 1. Using a Webhook to Your Own Service Configure a webhook that sends registration data to your own service, which then uses the AWS SES SDK to send a customized welcome email:
Copy code
hook: web_hook config:   url: <https://your-service.example.com/new-user-email>   method: POST   body: <base64://ENCODED_JSONNET> # Contains user data   auth:     type: basic_auth     config:       user: my-username       password: my-password
### 2. Using Mailchimp/Mandrill Integration If you prefer using Mailchimp's transactional email service (Mandrill) instead of directly using AWS SES for this specific email: 1. Set up the [Mailchimp integration with Ory Actions](https://www.ory.sh/docs/actions/integrations/mailchimp) 2. Configure it to trigger after registration ### 3. Using HTTP Server for Email Delivery You can also configure Ory to use an HTTP server for email delivery instead of SMTP:
Copy code
courier:   delivery_strategy: http   http:     request_config:       url: <https://your-email-service.example.com>       method: POST       body: base64://... # Template with user data
[Send emails using an HTTP server](https://www.ory.sh/docs/kratos/emails-sms/sending-emails-smtp#send-emails-using-an-http-server) provides more details on this approach. ## Monitoring Email Delivery After setting up your action, you can monitor email delivery on the MonitoringEmail Delivery page in the [Ory Console](https://console.ory.sh/projects/current/email-delivery) to ensure your emails are being sent correctly. If you encounter any issues, check the [Troubleshooting](https://www.ory.sh/docs/kratos/emails-sms/sending-emails-smtp#troubleshooting) section for common problems and solutions.