0
На рассмотрении
How to send email to multiple addresses?
I'm using this script and it works for 1 email, but how do i send the same email to more than 1 address??
function try_to_send ()
{
send_email("Smart Home", "from@gmail.com", "pass", "to@gmail.com", "TEST email", "xxxxxx content xxx")
}
Сервис поддержки клиентов работает на платформе UserEcho
Hello.
Call the function with sending for each email (it is possible in a loop if the list of recipients is large and changes frequently). If you do not have your own SMTP server (use a third-party), then check with the mail administrator the rules of mailing (how many letters per hour, the interval of sending, etc.).
Ok thank you. Can you just tell me how do i call this function later in the script for example?
Like this?
Yes.
For example:
if ((name == "Reg_02") && (value == 100))
{
try_to_send();
}
The function try_to_send() must contain instructions for sending to multiple recipients. If possible (you are the administrator of the SMTP server), the monitor attempts to send itself to the SMTP server: connection, authentication, sending, etc. So it will be easier to understand if something does not work.
so should it be like this for multiple recipients?
Yes, this method will also work.
If you use a third-party SMTP server - make sure that you do not violate the rules of e-mailing (otherwise, a third-party SMTP server can classify as spam).