8 Replies - 245 Views - Last Post: 09 April 2019 - 06:55 AM Rate Topic: -----

#1 jahodovy   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 09-April 19

Sending an email on click

Posted 09 April 2019 - 06:19 AM

I have been trying to put function to send email on link click, I have tried to implement it inside echo but it didnt work out. more in screenshot. Sending email works but if i put basically href=" ' . Email::sendEmail . '" it will send an email every time page is refreshed.
Is This A Good Question/Topic? 0
  • +

Replies To: Sending an email on click

#2 andrewsw   User is offline

  • quantum multiprover
  • member icon

Reputation: 6792
  • View blog
  • Posts: 28,050
  • Joined: 12-December 12

Re: Sending an email on click

Posted 09 April 2019 - 06:21 AM

Please provide relevant code, posted between code tags.
Was This Post Helpful? 0
  • +
  • -

#3 jahodovy   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 09-April 19

Re: Sending an email on click

Posted 09 April 2019 - 06:22 AM

https://i.imgur.com/WOw6b5y.png

case 'guest_link':
                $guestCode = get_post_meta($cptId, 'guest_code', true);
                if (!empty($guestCode)) {
										
                    echo '<a href="?link=1" name="link1" class="send-guest-email" style="cursor:pointer;" data-flight-id="' . $cptId . '" ><span class="dashicons dashicons-email-alt" style="padding-right:4px;"></span></button>';
						SENDING EMAIL AFTER CLICKING LINK UPSIDE 
					echo '<a href="' . Core::getGuestLinkPageUrl($guestCode) . '" target="_blank"><span class="dashicons dashicons-admin-links"></span></a>';
					 
				}
                break;

Was This Post Helpful? 0
  • +
  • -

#4 andrewsw   User is offline

  • quantum multiprover
  • member icon

Reputation: 6792
  • View blog
  • Posts: 28,050
  • Joined: 12-December 12

Re: Sending an email on click

Posted 09 April 2019 - 06:29 AM

What do you see when you inspect the element(s) in your browser? Is it the HTML that you expect to see?
Was This Post Helpful? 0
  • +
  • -

#5 jahodovy   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 09-April 19

Re: Sending an email on click

Posted 09 April 2019 - 06:36 AM

Yes, page is running good . I tried to add onclick="function()" function that called Email:sendEmail but it didnt work, also i added alert notice into function that didnt showed
Was This Post Helpful? 0
  • +
  • -

#6 no2pencil   User is offline

  • Professor Snuggly Pants
  • member icon

Reputation: 6759
  • View blog
  • Posts: 31,256
  • Joined: 10-May 07

Re: Sending an email on click

Posted 09 April 2019 - 06:41 AM

Does the server send emails outside of this functionality?
Was This Post Helpful? 0
  • +
  • -

#7 jahodovy   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 09-April 19

Re: Sending an email on click

Posted 09 April 2019 - 06:45 AM

Yes, there is another function that sends you an email when someone else register you. As i said, sending emails is fine, only problem is that i cant figure out how to implement onclick action inside that <a>
Was This Post Helpful? 0
  • +
  • -

#8 no2pencil   User is offline

  • Professor Snuggly Pants
  • member icon

Reputation: 6759
  • View blog
  • Posts: 31,256
  • Joined: 10-May 07

Re: Sending an email on click

Posted 09 April 2019 - 06:47 AM

Realize that an href is a client side action. It will need to communicate back to the server to issue an event. If this were my project, I would implement an Ajax listener, capture the event, & put the email request in a queue. Then perform validation against the queue to prevent duplicate emails, spam, scams, & so forth. I don't know what Core::getGuestLinkPageUrl($guestCode) is, what it represents, or how it works.
Was This Post Helpful? 0
  • +
  • -

#9 jahodovy   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 09-April 19

Re: Sending an email on click

Posted 09 April 2019 - 06:55 AM

Only administrators can send emails so there is no chance on spam etc. Basicaly its site where you register ticket with your problem and if your problem is solved administrator can (currently cant) send email that problem is solved
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1