
On Wed, Nov 11, 2020 at 05:11:59PM +0800, Li Yuanchao wrote:
+ def send_mail(message) + email_message = if message.empty? + build_apply_account_email(@my_info) + else + build_apply_account_fail_email(@my_info, message) + end
This style is strange.
I think this still works well or if error_message.empty? email_message = build_apply_account_email(@my_info) else email_message = build_apply_account_fail_email(@my_info, error_message) end works Thanks, Luan Shengde
You can define a method
def get_email_message(message) return build_apply_account_email(@my_info) if message.empty?
return build_apply_account_fail_email(@my_info, message) end
email_message = get_email_message(message)
Thanks, Yuanchao
+ + %x(curl -XPOST "#{@send_mail_host}:#{@send_mail_port}/send_mail_text" -d "#{email_message}") + end +end -- 2.23.0