ryancramerdesign / ProcessWire

Our repository has moved to https://github.com/processwire – please head there for the latest version.
https://processwire.com
Other
727 stars 198 forks source link

PHP Fatal error: Call to undefined function wireMail() #2058

Closed DZuz14 closed 7 years ago

DZuz14 commented 7 years ago

Not particularly fancy with processwire(coming from Node and React), but am helping someone fix up their e-commerce site. Everything has been quite enjoyable except for the issue I am having with setting up a cron job on my server and trying to send mail. Don't worry, the cron job executes just fine, I just get this error each time in the logs,

PHP Fatal error: Call to undefined function wireMail().

Here is my test php script in all it's glory,

`<?php

$subject = 'This is a great subject';
$message = 'Hello Dan, how are you doing this evening?';

$mail = wireMail();
$mail->to('myemailaddress@gmail.com');
$mail->from(wire('config')->scFromEmail);
$mail->subject($subject); 
$mail->bodyHTML($message); 
$mail->send();

?>`

This php script sits inside processwire itself. I am used to having to import modules into the head of my files, but it looks like other pages on the existing site don't "include" anything related to wireMail, and they work just fine.

I must be missing something, any help? Site is running processwire 2.6.1

DZuz14 commented 7 years ago

whoops...need to bootstrap processwire itself at the top of the file. easy fix.

include_once('/home/username/www/index.php');