Thank you! Not sure how I missed that option, but that works as required.
Thanks, J
@johntui - OK, sorry it does not work. My solution works with the template 9.3 version using sendgrid.
The only change I made was to enable email sending in debug mode for testing. Other than that, in case it helps here are the SMTP settings I am using;
SMTP host = smtp.sendgrid.net SMTP port = 465 Use SSL = ticked Domain name = sendgrid.net user name = apikey password = my api token from sendgrid account
@johntui you need to be signed in to GitHub in order to see the page, otherwise you get 404 Page Not Found. You also need access to the AspNetZero repository on Github.
But the following was what that commit is, and what I did to get it working;
In aspnet-core/src/MyCompanyName.AbpZeroTemplate.Core/AbpZeroTemplateCoreModule.cs
Add ` using MailKit.Net.Smtp; using MailKit.Security;``
And then in the PreIntitialize() Method:
// MailKit configuration
Configuration.Modules.AbpMailKit().SecureSocketOption = SecureSocketOptions.Auto;
Configuration.ReplaceService<IMailKitSmtpBuilder, AbpZeroTemplateMailKitSmtpBuilder>(DependencyLifeStyle.Transient);
`
Then in aspnet-core/src/MyCompanyName.AbpZeroTemplate.Core/Net/Emailing/AbpZeroTemplateMailKitSmtpBuilder.cs
`using Abp.MailKit; using Abp.Net.Mail.Smtp; using MailKit.Net.Smtp;
namespace MyCompanyName.AbpZeroTemplate.Net.Emailing { public class AbpZeroTemplateMailKitSmtpBuilder : DefaultMailKitSmtpBuilder { public AbpZeroTemplateMailKitSmtpBuilder( ISmtpEmailSenderConfiguration smtpEmailSenderConfiguration, IAbpMailKitConfiguration abpMailKitConfiguration) : base(smtpEmailSenderConfiguration, abpMailKitConfiguration) {
}
protected override void ConfigureClient(SmtpClient client)
{
client.ServerCertificateValidationCallback = (sender, certificate, chain, errors) => true;
base.ConfigureClient(client);
}
}
}``
OK, great, it works. Thanks!
Finally I found the problem! I had not implemented IApplicationService on the interface - schoolboy error :)
Thanks.
@maliming where should I email the zip of the demo project to for you to look at?
OK, that was my oversight, I had not added Abp.AspNetCore dependency, which I have now done and therefore inserting
public override void PostInitialize() { IocManager.Resolve<ApplicationPartManager>() .AddApplicationPartsIfNotAddedBefore(typeof(YourModule).Assembly); }
In CustomServicesModule.cs compiles fine now.
But I still cannot see the module through Swagger.
There is a similar entry in WebCoreModule.cs and that does not display the error.
Hi, sorry, but how/where do I need to add this to my project? Im not sure what you mean as that code is part of the ABP source.
I tried to add this to my MyCompanyName.CustomServiceModule.cs PostInitialize() but I get an error:
'ApplicationPartManager' does not contain contain a definition for 'AddApplicationPartsIfNotAddedBefore' and no accessible extension method 'AddApplicationPartsIfNotAddedBefore' accepting a first argument of type 'ApplicationPartManager' could be found (are you missing a using directive or an assembly reference).
I ahve added
using Microsoft.AspNetCore.Mvc.ApplicationParts;
Thanks,
Jason