Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Would you be able to point me in the right direction to get this to work e.g. some documentation around how the email templates are set up and work, so basically am trying to use 1 of the built in email templates to manually send a customized email (HTML Wise) after an order is complete.
Initially just trying to send the email from an order using the confirmation email out of the box, i am getting the error below:
System.Net.Mail.SmtpException: Failure sending mail. ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:25
So am thinking there is some configuration of some sort that i need to enable sending these email.
In my system am currently using Custom logic to send emails using SendGrid, how can i, if possible, use sendgrid to also send the email, assuming i can pretty much use the template i.e. email-template-confirmation.cshtml to customize the HTML i want to be sent in the email.
Thanks for the help.
That exception suggests it is attempting to send the email, but the server doesn't have an SMTP service configured.
You'll need to make sure you have SMTP configuration in your web.config, setup with some working details.
<smtp from="[email protected]">
If you want to use SendGrid you should checkout their docs to see how to use them as a SMTP gateway https://docs.sendgrid.com/for-developers/sending-email/integrating-with-the-smtp-api
In terms of how you send an email, you'll need to use the EmailTemplateService
var emailTemplate = EmailTemplateService.Instance.Get(storeId, emailTemplateId);
This should automatically create the email and send it using the configured SMTP credentials mentioned above.
Thanks for the details will give that a go and let you know how i get on, def didnt have any SMTP setting in my web config as i am using this sendgrid Nuget package https://github.com/sendgrid/sendgrid-csharp which only need the API Key.
As for sending the email template itself, guess if its from the order page shown below i don't need to use the EmailTemplateService , that will only be if im sending it manually from my own code right?
Glad that worked for you. And yea, if you are just using the "send email" button, then you don't need to do any custom code. 👍
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted