I have a report that runs 3 other reports and sends them as an email. When I run this report in the mydbr webpage it works find and the attachments have content. When I run the report using WGET from cron I get an email, but all the attachments are 0 byte sized files. Changing the format of the reports from PDF to XLSX makes no difference, I still get 0 byte attachments.
Cronjob:
* We have many other reports that use wget to trigger emailing reports from Cron so I'm reasonably confident that wget isn't the issue.
wget -O - "https://myreporturl.net/report.php?r=100&m=11&h=somehashhere"
Sproc for the report:
* Again this works from the browser just not from Cron.
DROP PROCEDURE IF EXISTS sp_DBR_scheduledReport_Sos_Fraud_reports
$$
CREATE PROCEDURE
sp_DBR_scheduledReport_Sos_Fraud_reports
()
BEGIN
SELECT CURDATE() INTO @today; SELECT CURDATE() - INTERVAL 1 DAY INTO @yesterday; SELECT CURDATE() - INTERVAL 30 DAY INTO @one_month_ago;
select 'dbr.mail'; select 'dbr.mail.attach', 'Report 1.pdf', CONCAT("https://myreporturl.net/report.php?r=97&u1=",@one_month_ago,"&u2=",@today,"&m=7&h=hash1&export=pdf");
select 'dbr.mail.attach', 'Report 2.pdf', CONCAT("https://myreporturl.net/report.php?r=98&u1=",@yesterday,"&u2=",@yesterday,"&u3=",'PTS',"&m=7&h=hash2&export=pdf");
select 'dbr.mail.attach', 'Report 3.pdf', CONCAT("https://myreporturl.net/report.php?r=98&u1=",@yesterday,"&u2=",@yesterday,"&u3=",'NEI',"&m=7&h=hash3&export=pdf");
select 'dbr.mail.recipient', 'john@primetimesolutions.com', 'John Hirbour';
select 'dbr.mail.debug', 1; select 'dbr.export.options', 'debug', 1;
select '', '', 'SOS Fraud Reports', 'See attached PDF';
END $$
output from wget
2014-09-11 13:26:07 CLIENT -> SERVER: AUTH LOGIN
2014-09-11 13:26:07 CLIENT -> SERVER: REDACTED
2014-09-11 13:26:07 CLIENT -> SERVER: REDACTED
2014-09-11 13:26:07 CLIENT -> SERVER: MAIL FROM:<REDACTED>
2014-09-11 13:26:07 CLIENT -> SERVER: RCPT TO:<john@primetimesolutions.com>
2014-09-11 13:26:07 CLIENT -> SERVER: DATA
2014-09-11 13:26:07 CLIENT -> SERVER: Date: Thu, 11 Sep 2014 09:26:07 -0400
2014-09-11 13:26:07 CLIENT -> SERVER: Return-Path: <app1@primetimesolutions.com>
2014-09-11 13:26:07 CLIENT -> SERVER: To: John Hirbour <john@primetimesolutions.com>
2014-09-11 13:26:07 CLIENT -> SERVER: From: REDACTED
2014-09-11 13:26:07 CLIENT -> SERVER: Reply-To: REDACTED
2014-09-11 13:26:07 CLIENT -> SERVER: Subject: REDACTED
2014-09-11 13:26:07 CLIENT -> SERVER: Message-ID: <REDACTED@REDACTED>
2014-09-11 13:26:07 CLIENT -> SERVER: X-Priority: 3
2014-09-11 13:26:07 CLIENT -> SERVER: X-Mailer: PHPMailer 5.2.7 (https://github.com/PHPMailer/PHPMailer/)
2014-09-11 13:26:07 CLIENT -> SERVER: MIME-Version: 1.0
2014-09-11 13:26:07 CLIENT -> SERVER: Content-Type: multipart/mixed;
2014-09-11 13:26:07 CLIENT -> SERVER: boundary="b1_47fc287a852d2e1621cfd727d7f695b5"
2014-09-11 13:26:07 CLIENT -> SERVER: Content-Transfer-Encoding: 8bit
2014-09-11 13:26:07 CLIENT -> SERVER:
2014-09-11 13:26:07 CLIENT -> SERVER: --b1_47fc287a852d2e1621cfd727d7f695b5
2014-09-11 13:26:07 CLIENT -> SERVER: Content-Type: text/plain; charset=UTF-8
2014-09-11 13:26:07 CLIENT -> SERVER: Content-Transfer-Encoding: 8bit
2014-09-11 13:26:07 CLIENT -> SERVER:
2014-09-11 13:26:07 CLIENT -> SERVER: See attached PDF
2014-09-11 13:26:07 CLIENT -> SERVER:
2014-09-11 13:26:07 CLIENT -> SERVER:
2014-09-11 13:26:07 CLIENT -> SERVER: --b1_47fc287a852d2e1621cfd727d7f695b5
2014-09-11 13:26:07 CLIENT -> SERVER: Content-Type: application/pdf; name="Report 1.pdf"
2014-09-11 13:26:07 CLIENT -> SERVER: Content-Transfer-Encoding: base64
2014-09-11 13:26:07 CLIENT -> SERVER: Content-Disposition: attachment; filename="Report 1.pdf"
2014-09-11 13:26:07 CLIENT -> SERVER:
2014-09-11 13:26:07 CLIENT -> SERVER: --b1_47fc287a852d2e1621cfd727d7f695b5
2014-09-11 13:26:07 CLIENT -> SERVER: Content-Type: application/pdf; name="Report 2.pdf"
2014-09-11 13:26:07 CLIENT -> SERVER: Content-Transfer-Encoding: base64
2014-09-11 13:26:07 CLIENT -> SERVER: Content-Disposition: attachment; filename="Report 2.pdf"
2014-09-11 13:26:07 CLIENT -> SERVER:
2014-09-11 13:26:07 CLIENT -> SERVER: --b1_47fc287a852d2e1621cfd727d7f695b5
2014-09-11 13:26:07 CLIENT -> SERVER: Content-Type: application/pdf; name="Report 3.pdf"
2014-09-11 13:26:07 CLIENT -> SERVER: Content-Transfer-Encoding: base64
2014-09-11 13:26:07 CLIENT -> SERVER: Content-Disposition: attachment; filename="Report 3.pdf"
2014-09-11 13:26:07 CLIENT -> SERVER: --b1_47fc287a852d2e1621cfd727d7f695b5--
2014-09-11 13:26:07 CLIENT -> SERVER:
2014-09-11 13:26:07 CLIENT -> SERVER: .
2014-09-11 13:26:07 CLIENT -> SERVER: RSET
2014-09-11 13:26:07 CLIENT -> SERVER: QUIT
</div><div class="comment">Sent 1 mail with no errors</div></div>