send email with condition

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
danilo.macri
User
Posts: 100

send email with condition

Post by danilo.macri »

HI,
I use the phpmaker email module and it works very well.
I have activated email notification on add but I want the email to be sent when the send field (present in the table) is true. if the field is false you do not have to send the email


mobhar
User
Posts: 11765

Post by mobhar »

You may simply use Email_Sending server event. Just check the condition in that event. If you want to send email, then make sure you return true, otherwise, return false.


danilo.macri
User
Posts: 100

Post by danilo.macri »

Perfect, thanks.... It happens that my company updates the mail server for a period and then during the insertion phase phpmaker returns the following popup error
"SMTP Connect() failed. https://github.com/PHPMailer/PHPMailer /wiki/Troubleshooting"
the record is inserted but the add page remains open until I cancel.
I can bypass this error, i.e. I would like the insertion to continue in the event of an error.... or after the error popup, when I click ok, the insertion process continues. Thank you


arbei
User
Posts: 9434

Post by arbei »

  1. You should turn on Debug and check the SMTP log and errors.
  2. Be reminded that you have submitted the page to the server side already for inserting and then sending email, you cannot have a client side button to pause and then continue. Note also that email is sent after records is inserted successfully. You should find out and rectify the SMTP error.

Post Reply