› Forums › Network Management › ZeroShell › send mail
- This topic is empty.
-
AuthorPosts
-
June 30, 2010 at 7:22 pm #42475
redfive
ParticipantHi there, I’d like to send a mail when the sistem reboots , but I’m not able to do this 🙁 …..I tried to make a test with a script like this in cronjob , but doesn’t works
#!/usr/bin/perl
use Net::SMTP;
$remote_smtp_host = 'smtp.dominio.tld';
$sender = 'indirizzo email del mittente';
$sender_name = 'nome del mittente';
$recipient = 'indirizzo email del destinatario';
$recipient_name = 'nome del destinatario';
$subject = 'Sendmail.pl Test';
$body = "Questo e' un test dello script Sendmail.pln";
$smtp=Net::SMTP->new("$remote_smtp_host") or die($!);
$smtp->mail("$sender");
$smtp->to("$recipient");
$smtp->data();
$smtp->datasend("Subject: $subjectn");
$smtp->datasend("To: $recipient_namen");
$smtp->datasend("From: $sendernamen");
$smtp->datasend("$body");
$smtp->dataend();
$smtp->quit;the zeroshell returns the following message
/tmp/ScriptToRun21973: line 4: use: command not found
/tmp/ScriptToRun21973: line 6: =: command not found
/tmp/ScriptToRun21973: line 8: =: command not found
/tmp/ScriptToRun21973: line 9: =: command not found
/tmp/ScriptToRun21973: line 11: =: command not found
/tmp/ScriptToRun21973: line 12: =: command not found
/tmp/ScriptToRun21973: line 14: =: command not found
/tmp/ScriptToRun21973: line 16: =: command not found
/tmp/ScriptToRun21973: line 18: syntax error near unexpected token _('
/tmp/ScriptToRun21973: line 18: __smtp=Net::SMTP->new("_remote_smtp_host") or die(_!);'
[Cron mail]: ERROR (2)
Maybe I’ve to install this pearl module ??
http://search.cpan.org/~gbarr/libnet-1.22/Net/SMTP.pm
How can I do it ?
thanks !!
jonathaJuly 16, 2015 at 12:47 pm #50606RudolfAT
MemberWith Zeroshell 3.3.2, there is a built-in feature “Monitoring”, which can send e-mails on various events and also at shutdown and restart.
For manually sending mails, see “/usr/bin/smtp-cli –help”.
July 18, 2015 at 5:44 am #50607approved_ok
Memberusing Monitor for emailing (via gmail) always get the message:
Connect failed: IO::Socket::INET6: connect: timeout
tried manually from smtp-cli got the same message
can anyone help me ??
July 19, 2015 at 9:11 pm #50608getout
MemberI haven’t been able to get Gmail SMTP working in the Monitoring settings. Try using an SMTP email server on your LAN, maybe your router has an SMTP relay you could use or you could try using the SMTP settings of your ISP.
Once operational the Monitoring Module is very convenient. Don’t forget to add your email recipients.
-
AuthorPosts
- You must be logged in to reply to this topic.