K
K
KindOfHeaven2016-12-11 16:27:53
CMS
KindOfHeaven, 2016-12-11 16:27:53

How to access php file to send email?

I have a site on CMS H-SCRIPT, Smarty template engine, how can I access a php file to send an email? (AJAX+PHP)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan Kolesnik, 2016-12-11
@dart_kinselok

A simple, simplified
JS example

$.post(
    '/mail.php',
    {
        email: $('#email').val(),
        message: .......
    }, function (data) {
        if(data) {
            alert('Сообщение отправлено!');
        } else {
            alert('Ошибка');
        }
    }
);

PHP:
<?php
    return mail($_POST['email'], ' Тема моего письма... ', $_POST['message']);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question