bblef91 Posted June 24, 2016 Share Posted June 24, 2016 My question is simple. How to access WireMail with bootstraping ProcessWire? Link to comment Share on other sites More sharing options...
flydev Posted June 25, 2016 Share Posted June 25, 2016 Hi, You could do something like that, assuming you are on PW-3. Create a file called testwiremail.php in the root directory and add the following code : <?php namespace ProcessWire; include_once ('./index.php'); // bootstrap try { $mail = wireMail(); $mail->to('someone@domain.com'); $mail->from('root@mydomain.com', 'My Company'); $mail->subject('My subject'); $mail->bodyHTML('My message body'); $mail->send(); } catch(\Exception $ex) { echo $ex->getMessage(); } Now you can navigate to http://mydomain.com/testwiremail.php 1 Link to comment Share on other sites More sharing options...
bblef91 Posted June 25, 2016 Author Share Posted June 25, 2016 I get errors with namespace ProcessWire; and $mail = wireMail(); Link to comment Share on other sites More sharing options...
flydev Posted June 25, 2016 Share Posted June 25, 2016 Could you tell us which version of ProcessWire you are using please ? 1 Link to comment Share on other sites More sharing options...
bblef91 Posted June 25, 2016 Author Share Posted June 25, 2016 ProcessWire 2.5.3 Link to comment Share on other sites More sharing options...
flydev Posted June 25, 2016 Share Posted June 25, 2016 just remove the namespace. The code should be : <?php include_once ('./index.php'); // bootstrap try { $mail = wireMail(); $mail->to('someone@domain.com'); $mail->from('root@mydomain.com', 'My Company'); $mail->subject('My subject'); $mail->bodyHTML('My message body'); $mail->send(); } catch(Exception $ex) { echo $ex->getMessage(); } Does it work ? 1 Link to comment Share on other sites More sharing options...
bblef91 Posted June 25, 2016 Author Share Posted June 25, 2016 Still getting an error at $mail = wireMail(); I also tried $mail = new WireMail(); and it also makes an error Link to comment Share on other sites More sharing options...
flydev Posted June 25, 2016 Share Posted June 25, 2016 Please show us more details about the error. 3 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now