Issue sending mail via cancellation/approve link

Support forumCategory: QuestionsIssue sending mail via cancellation/approve link
Attila asked 5 years ago
I have issues sending out mail after using the cancellation/approval link in e-mails. Sending out test mail (both normal and native) is working fine. Also the mails to the customer and Admin goes out well after registering the appointment. But sending mails via the links fail with an entry in the error log:TYPE: MAILERRORS: {“wp_mail_failed”:[“SMTP Error: Could not authenticate.”]} I’m using WP Mail SMTP plugin and the SMTP service of my hosting provider. Please help me to find the way out. I also tried to switch off sending by SMTP in the WP Mail SMTP plugin and then it works fine. However obviously I would prefer to use SMTP also in the future. Thank you in advance,Attila
11 Answers
Nikola Loncar Staff answered 5 years ago
HI Attila, mail notification after user clicks on link is the same as booking appointments. There should be no difference between those two. Can you please check user/pass settings for SMTP plugin? Best regards, Nikola
titala replied 5 years ago

Hi Nikola,
This is very strange. There must be a difference somewhere. I just figured out the solution/workaround. For WP Mail SMTP you can set up the SMTP password also in the wp-config.php because of security reasons. The mail via link is not working in this case. However if you specify the password in the WP Mail SMTP setup then it works without any problem.
Best regards,
Attila

titala answered 4 years ago
Hi Nikola, The solution direction has been explained by WP Mail SMTP support: https://wordpress.org/support/topic/hide-password-in-wp-config-blocks-sending/ Based on that I believe at the moment only you can resolve the issue. Hope it is coming soon. Regards, Attila
Nikola Loncar Staff answered 4 years ago
Hi Attila, I have check that thread. There it is saying that you need to define Consts for those access data should be defined at right place. If that is not the case it will not be loaded. Have you put it inside wp-config.php? Best regards, Nikola
titala answered 4 years ago
Dear Nikola, The constant is definitely defined. In general the mail sending is working fine. I mean the second part of their answer  "it might be because the constants for the password aren’t yet defined at the time of sending the emails. Please make sure the constants are added correctly and defined when the emails are sent." Since the issue only happens in the case the mail sending triggered by cancel/approve link, I believe the constant is not defined yet at the time of mail sending. With other words the mail is sent too early or without letting the opportunity to define the constant coming from the wp-config.php. Regards, Attila
Nikola Loncar Staff replied 4 years ago

Hi Attila, I will have to test this and let you know. I will define some variable and access it during email trigger from link.

Best regards,
Nikola

titala replied 4 years ago

Thx for your efforts!

titala answered 4 years ago
Hi Nikola, Any news concerning this?
titala answered 4 years ago
Hi Nikola, Do you still plan to check this? Thx, Attila
Nikola Loncar Staff answered 4 years ago
Hi Attila, can you please try next thing. Open wp-content/plugins/easy-appointments/src/mail.php and there find: add_action('init', array($this, 'parse_mail_link')); should be on line 61 and change it to: add_action('init', array($this, 'parse_mail_link', 10000)); and see if that is solving the issue? Best regards, Nikola
titala answered 4 years ago
Hi Nikola, Unfortunately not. The situation is the same: ------------ ERROR #46 ------------
TYPE: MAIL
ERRORS: {"wp_mail_failed":["SMTP Error: Could not authenticate."]} Regards, Attila
titala answered 4 years ago
Sorry, I have to correct myself. The situation is not the same, it is even worse.
  • No screen message was displayed about the cancellation (That was the test case).
  • Appointment was not cancelled.
  • No mailing error message was generated,
  • No e-mail was sent,
  • Cancellation from the dashboard is still working and also the mails were properly sent.
BR, Attila  
Nikola Loncar Staff replied 4 years ago

Huh, that is a problem. I will see to implement different way of handling those urls.

Best regards,
Nikola

titala answered 4 years ago
Seems to be solved by version 2.8.2
Nikola Loncar Staff answered 4 years ago
This should be fixed with latest version so I will close this thread :)    Best regards, Nikola