Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > Email sending issue View modes: 
User avatar
Member
Member
damon.amanabadi-artisgroup.com - 6/1/2011 1:50:24 AM
   
Email sending issue
I'm using EmailEngine class to send emails using the smtp server set on Kentico settings , I don't have any problem in setting emails in Kentico like Newsletter ,...
But
When My code send the request to engine to send emails , nothing is sent to recipients , and whenever I open the CMSdesk all the suspended emails sent !!!!
I'm using the 5.5 version and have tested this problem several times and am pretty sure that unless it seems funny , is happening.

User avatar
Kentico Support
Kentico Support
kentico_radekm - 6/1/2011 2:27:38 AM
   
RE:Email sending issue
Hello.

What code in particular are you using, please? Could you post whole code in here, so I can see it? Also - where do you call that code, please? Thank you.

Best Regards,
Radek Macalik

User avatar
Member
Member
damon.amanabadi-artisgroup.com - 6/1/2011 2:32:01 AM
   
RE:Email sending issue

This is the code I 'm using:

CMS.EmailEngine.EmailMessage em = new CMS.EmailEngine.EmailMessage();
em.EmailFormat = CMS.EmailEngine.EmailFormatEnum.Html;
em.From = "info@maxtv.com.au";
em.Recipients = email;
em.Subject = "Subject";
em.Body = emailBody;
CMS.EmailEngine.EmailSender.SendEmail(em);

It's running during a WCF service call.

User avatar
Kentico Support
Kentico Support
kentico_radekm - 6/1/2011 7:31:43 AM
   
RE:Email sending issue
Hello.

The problem seems to be following. When executing given code via WCF, it is possible that site is not running, or more precisely there can be no activity on your site, so scheduler is not running. When you log-in CMSDesk, scheduler is started and e-mails are being sent.

Best Regards,
Radek Macalik

User avatar
Member
Member
damon.amanabadi-artisgroup.com - 6/2/2011 8:04:30 PM
   
RE:Email sending issue
Thhanks for your effort but this is not helping me to fix my issue,
Is there any solution to force scheduler running with code ?

Regards,
Damon

User avatar
Kentico Consulting
Kentico Consulting
kentico_borisp - 6/2/2011 10:43:25 PM
   
RE:Email sending issue
Hello,

Yes, you can run your own code in a custom scheduled task. For more information please check this documentation.

Best regards,
Boris Pocatko

User avatar
Member
Member
damon.amanabadi-artisgroup.com - 6/2/2011 10:47:43 PM
   
RE:Email sending issue
Hi,

This piece of code should be run via a service call , it can't be a scheduled task. This solution can't help me.

Regards,

User avatar
Kentico Consulting
Kentico Consulting
kentico_borisp - 6/2/2011 11:05:52 PM
   
RE:Email sending issue
Hello,

Have you tried to debug your code to see, if it's executed after the call? Just run your site in the debug mode and place a breakpoint into your code.

Best regards,
Boris Pocatko

User avatar
Member
Member
damon.amanabadi-artisgroup.com - 6/2/2011 11:22:52 PM
   
RE:Email sending issue
Hi Boris,

I've done this and the fact that the correct emails are sending after opening Kentico Desk is showing that my code is running and sending the proper request to Kentico email engine

Cheers

User avatar
Kentico Consulting
Kentico Consulting
kentico_borisp - 6/2/2011 11:44:43 PM
   
RE:Email sending issue
Hello,

I am sorry for not stating this clearly. Gets your code called after the WCF service call? I am aware that your code is called after you sign in into CMSDesk, since you've stated it in the previous posts.

Best regards,
Boris Pocatko

User avatar
Member
Member
damon.amanabadi-artisgroup.com - 6/2/2011 11:49:59 PM
   
RE:Email sending issue
My code is called , 100% sure.
It seems that the emails are queued and sent one after one after logging in to CMSDesk.

Thanks

User avatar
Kentico Consulting
Kentico Consulting
kentico_borisp - 6/3/2011 3:01:36 AM
   
RE:Email sending issue
Hello,

I've finally got hold of our technical leader. He explained, that emails are queued but the scheduler is not executed without a request. You could optionally try to use the following setting in the AppSettings section in your web.config file to enable the automatic scheduler:

<add key="CMSUseAutomaticScheduler" value="true" />

For more information please check our documentation.

Best regards,
Boris Pocatko