E-mail with Phpmailer and Cron (Ubuntu)

Asked

Viewed 134 times

1

To schedule email submissions, do you need to do something other than put the file inside the /etc/cron.Aily folder (for daily submissions)? This code works when I run directly on the server, you need to edit some other file to make the scheduled upload?

<?php
    require 'http://insidetv.net.br/PHPMailer/class.phpmailer.php';

    $email = new PHPMailer();

    $email -> IsSMTP();
    $email -> Mailer = 'smtp';
    $email -> SMTPAuth = true;
    $email -> Host = 'smtp.gmail.com';
    $email -> Port = 465;
    $email -> SMTPSecure = 'ssl';
    $email -> CharSet = 'UTF-8';

    $email -> Username = "[email protected]";
    $email -> Password = "********";

    $email -> IsHTML(true);
    $email -> SingleTo = true;

    $email -> From = "[email protected]";
    $email -> FromName = "InsideTv";

    $email -> addAddress("[email protected]");

    $email -> Subject = "teste";
    $email -> Body = "teste";
    $email -> send();
?>
  • I’m sure this is it? require 'http://insidetv.net.br/PHPMailer/class.phpmailer.php';

  • Yes, the way is right.

  • I don’t know how your files are, but try require 'PHPMailer/class.phpmailer.php';.

  • Still not sending.

  • You can post the command you used to schedule this task?

  • From what I read, to schedule time, day, week, month, just put the file into the respective folder. Only one command needs to be executed for specific times.

Show 1 more comment
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.