L
L
Let_peace2020-08-10 13:37:55
PHP
Let_peace, 2020-08-10 13:37:55

How to implement sending a message from the server to mail / telegram (anywhere) using php or javascript?

I made a button on the site, when you click on it, some message is collected and sent to the mail using mail in php. As I already understood, this method is outdated and not reliable, since the server often does not consider it necessary to send this letter to the mail. Therefore, the question arose, how to correctly send a message to mail or telegram / VK using bots ? In which language is it better to do this: php or JavaScript ? What are the pitfalls?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Vladimir Korotenko, 2020-08-10
@Let_peace

The most correct option is to set up a local mailer.
It will accept all your mail via mail, add the necessary headers and send it, if something is wrong, all this will be reflected in the logs.
The second option is phpmailer
https://snipp.ru/php/smtp-phpmailer

A
Alexey, 2020-08-10
@Upachko

If you need to send to the cart by phone number, then there is either a madeline proto for php. So far, this is the only working method I've found.
Well, you can also write to groups, etc.

A
Alexander Toropov, 2020-08-20
@nefone

If the task is to send mail using PHP, it is better to use the PHPMailer library and set up sending mail via SMTP.
The PHP mail() function has a place to be, but it does not guarantee the delivery of a letter, there are problems with its use on different hostings.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question