ssossossosso

Forums

Covering OroCRM topics, including community updates and company announcements.  Subscribe

This topic contains 10 replies, has 4 voices, and was last updated by Yevhen Shyshkin Yevhen Shyshkin 1 year, 9 months ago.

  • Creator
    Topic
  • #15419

    KnutFr
    Participant

    Hi,

    Is it possible to use email template as services for example in my own controller ?
    I have a Job which have to send mails based on template with contact entity, there’s a way to do it as simple as possible?

    Thanks,
    KnutFr

Viewing 10 replies - 1 through 10 (of 10 total)
  • Author
    Replies
  • #15460

    Rodolfo
    Participant

    Hi there,

    Maybe calling the EmailTemplate entity? Something like:

    There is other option here: https://github.com/orocrm/platform/blob/ae09ef7175a0febc079b33d7a0b4d2ceab7cbc91/src/Oro/Bundle/UserBundle/Mailer/BaseProcessor.php#L81

    #15897

    KnutFr
    Participant

    Hi,

    I have another problem, I have a job which have to send mail to contact when his seniority is updated (every year) but nothing is sended (process execution is successful anyway).

    My process.yml:

    Everything is set, my mail template, my contact entity.
    Am I doing something wrong ?

    KnutFr

    #15898

    Rodolfo
    Participant

    I can see that it’s being queued. Is your Job-Daemon running? Any logs to help us?

    #15899

    KnutFr
    Participant

    Hi,

    Yes it’s always running but my job is a process and doesn’t appear in job queue.
    Is there any logs for process ?

    #15908

    Rodolfo
    Participant

    Did you run this command after you changed the process yml file?

    If you run your application with debug mode /app_dev.php you’ll get a more verbose log on app/logs/dev.log. Otherwise, you can try app/log/prod.log.

    I would like to have more experience with Email Process Triggers to help, so good luck!

    #16014

    KnutFr
    Participant

    There’s nothing on my log and also nothing in my system mail log …

    Maybe a mistake in my “actions_configuration” syntax ?

    #16083
    Yevhen Shyshkin
    Yevhen Shyshkin
    Oro Core

    Hello.

    Look’s like process configuration is fine (you can omit “time_shift: 0” because it doesn’t do anything in this case). Now the possible reasons why process not executed:

    1) process is not uploaded to DB (as @Rodolfo said) or disabled – it can be checked via UI at System > Processes

    2) process not triggered because “seniority” field is not changed or entity has no such field (look’s like the most probable reason for me)

    Couple of recommendations about process debugging:
    – you can make this process not queued, check that it works without queue and only then make it queued again
    – when you are testing queued process you can temporary stop job queue daemon, do required action, make sure that job appeared in queue and then start daemon again
    – also when daemon is stopped you can manually run command to execute process job and check that it works as expected

    Also, please, remember that job queue automatically cleared every day from successful jobs.

    Feel free to post here results of your investigation – I’ll try to help.

    #16146

    dwijadas
    Participant

    Something similar I have been looking for. Kindly share if you managed to achieve this.

    #16291

    KnutFr
    Participant

    I haven’t found a solution yet, but how can I send a template mail to a Contact entity in a controler ? (email template is based on Oro Contact Entity).

    For example, I have my $contact and my $template returned by Doctrine Entity Manager, there is a way to send it?

    Thanks a lot,
    KnutFr

    #16297
    Yevhen Shyshkin
    Yevhen Shyshkin
    Oro Core

    Sure, you can use SendEmailTemplate::executeAction as an example.

    So, you need to create Email object, fill it with data (from, to, subject, type), then render email body based on your template via EmailRenderer::compileMessage method, set this body to email model, and execute email sending via Processor::process.

Viewing 10 replies - 1 through 10 (of 10 total)

You must be logged in to reply to this topic.