Search in support tickets

#157 – Send custom mail to ad creator

Posted in ‘Support’
This is a public ticket. Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.
Friday, 08 December 2017 14:30 CET
silverman
Joomla! version : 3.8
PHP version : 7
AdsManager version : 3.1.11

Hello!

How can I send the user a custom email from backend. Can I make a "custom code field" for this?
So that when I press a button in backend inside a ad, a mail gets send to the user.

I tryed to make a field like this, and put this code in "Edit view custom code". But I think its the wrong way to do it.


<input type="submit" name="button" value="Send mail" class="button"

<?php
if (isset($_POST['button'])) {

$to = "user345@mail.com";
$From = "support@mysite.com";
$SMTPServer = "...";
$SMTPPort = ...;
$mail->SMTPSecure = "ssl";
$Username = "...";
$Password = "...";
$mail->SMTPAuth = ...;
$subject = utf8_decode('test');
$message = utf8_decode('hello user 345');
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= '...' . "\r\n" .
'Reply-To: ...' . "\r\n" .
'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);

}
Custom Fields
Joomla Version
3.8
PHP Version
7.0
Product
AdsManager
Product Version
3.1.11
Saturday, 09 December 2017 12:48 CET
juloaadmin
Without hacking It's a good idea to create a custom field. like this you can add some PHP code in the edit view .

The problem is that you will have to call a specific page when pressing the button in ajax for example
 
Tuesday, 12 December 2017 16:54 CET
silverman
So I cannot send mail like this directly from the custom field?

So what page do I need to call and how can I do this? Not sure how to make it work.
Tuesday, 12 December 2017 23:50 CET
juloaadmin
You can try some javascript lib : https://www.emailjs.com/ to be able to send email without server code.

Regarding your question, I cannot really tell you a file, it's a little more complicated that this. If you are used with PHP you will find it, otherwise I think you have to find someone to do this custom code.

Currently we are full on custom dev sorry
 
Wednesday, 13 December 2017 20:14 CET
silverman
Ok, I will see if I can find someone to help me with this.
Thanks!
Thursday, 14 December 2017 18:57 CET
juloaadmin
You're welcome

Sorry that we don't have time to help you on this
 
This ticket is closed, therefore read-only. You can no longer reply to it. If you need to provide more information, please open a new ticket and mention this ticket's number.