Documentation sending email with attachment in C#/.NET with Custom SMPT
Hi, i working on .net for create API that send an email with the attachment, but its not working. im looking for documentation or guidance to work with it. Thank you
6 Replies
Hey @MFM Tech, thanks for bring this up!
To send an email with an attachment using Novu in a C#/.NET environment, you would typically use the Novu API.
While the exact code for C#/.NET is not provided in the available documentation, the process is generally similar across different programming languages.
Based on the provided Node.js example from the Novu documentation, here is what you need to ensure:
1. Initialize the Novu client with your API key.
2. Use the trigger method with the appropriate workflow identifier.
3. Include the attachments array in the payload, with each attachment specified by its metadata (like file, name, and mime type).
For C#/.NET, you would need to adapt the process into a corresponding .NET HTTP client call to the Novu API.
You can find it here:
https://docs.novu.co/channels-and-providers/email/overview#sending-email-attachments
I've used ChatGPT to try and adapt to
.NET
but please check this up and see if it works, and please let me know what would be the correct code snippet so we could include this in our documentation:
Thank you very much for your help. I successfully send email with attachment using novu provider, but when i changed using the smtp to gmail / office 365, its not send the attachment. do you have any information about it ? @Emil
I'm looking into it now
Well, unfortunately, it might take me some time to get to the bottom of it.
It appears that the issue you're encountering could be related to the configuration or handling of the attachment data within the SMTP setup. To troubleshoot this, please ensure that the attachment is correctly formatted according to the requirements of the SMTP service you're using.
For Office 365, it's crucial to set up your SMTP credentials correctly in the Novu dashboard, and it should generally be capable of handling attachments if the integration is configured correctly.
What provider are you using for Custom SMTP?
Im testing to send email with attachment using my gmail as SMTP and the default provider which nodemailer i guess
Have you been following this documentation page: https://docs.novu.co/channels-and-providers/email/custom-smtp
Novu
Custom SMTP - Novu
Learn how to use the Custom SMTP provider to send email notifications using Novu
Could you please share more about the error or whatever you can detect?
Also consider visiting the Activity Feed section and learn about the triggers that were set in motion and share screenshots here 🙂