send mail

Home Page Forums Network Management ZeroShell send mail

This topic contains 2 replies, has 0 voices, and was last updated by  redfive 3 years, 10 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #42475

    redfive
    Participant

    Hi 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_name n");
    $smtp->datasend("From: $sendername n");
    $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 !!
    jonatha

    #50606

    RudolfAT
    Member

    With 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”.

    #50607

    approved_ok
    Member

    using 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 ??

    #50608

    getout
    Member

    I 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.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.