Closed fredsdc closed 1 year ago
Yes, it does. See the Wiki. You should call CustomWorkflowMailer.deliver_custom_email(issue.author, 'Subject', 'Body')
I have an error like this
Workflow script executable before saving observable object contains error: undefined local variable or method
issue' for #
but when i use @issue not working
What is the observable object? How about self.issue
?
Observable object is issue self.issue not working too
If the observable object is Issue, you can directly call its methods, so simply author
instead of self.issue.author
.
Ok, it works for author issue but if i want to send email to selected email on the picture? There is a way?
The first argument of the function must be a user. So you cannot sent an email to an email address but to a certain Redmine user only. As a workaround you can create a user with the given email address and then use them as the email recipient.
Yeah I did this, it is very nice plugin and simple but need some time to understand :) Thank you very much for your help.
How can I set for Body html value?
I had a similar problem. Finally I used ActionMailer to build and send the mail out of Redmine constraints.
Where: content_bh -> html of the body content_bp -> text of the body mail_to -> to mail_cc -> cc content -> subject tags -> tags for which attachments to include, search in description
html_part = Mail::Part.new do
content_type 'text/html; charset=UTF-8'
body content_bh
end
text_part = Mail::Part.new do
body content_bp
end
m=ActionMailer::Base.mail(
from: User.current.mail,
to: mail_to,
cc: mail_cc,
subject: content,
body: '',
content_type: "multipart/mixed"
)
self.attachments.select{|a| a.description.downcase.match?(tags.downcase)}.each do |a|
m.attachments[a.filename]=File.read(a.diskfile)
end
m.part content_type: "multipart/alternative" do |p|
p.html_part = html_part
p.text_part = text_part
end
m.deliver_now
You can use html_safe
function:
recipient = User.find(9)
CustomWorkflowMailer.deliver_custom_email(recipient,
'Subject',
'<b>Body</b>'.html_safe)
I tried to have a workflow send an email, using the given example and it gives the following error: undefined method `custom_email' for Mailer:Class
Do this still work?