hellomoto Posted January 11, 2015 Share Posted January 11, 2015 I'm trying to send an email notification for each inquiry submitted. Currently they're just saved as pages. I want to email notify too. So I have (mail part is at the bottom): // check if the form was submitted if($input->post->submit) { // determine if any fields were ommitted or didn't validate foreach($required_fields as $key => $value) { if( trim($value) == '' ) { $error_message = "<p class='error'>Please check that you have completed all the required fields.</p>"; $error = true; } } // if no errors, create a new page if(!$error) { $p = new Page(); // create new page object $p->template = 'vessel_inquiry'; // set template $p->parent = wire('pages')->get('/sales/inquiries/'); // set the parent $p->name = $input->post->vessel_id . '_' . date('YmdHisu') . '_' . $input->post->user_id; $p->title = $input->post->title; // set page title (not neccessary but recommended) $p->save(); //create the page // populate fields $p->message = $input->post->message; if($user->isLoggedin()) { $p->user = $input->post->user_id; } else { $p->fullname = $input->post->fullname; $p->email = $input->post->email; } $p->vessel_id = $input->post->vessel_id; $p->status = $p->status | Page::statusLocked; $p->save(); //save the populated fields $success = true; $mail = new WireMail(); // chained method call usage $mail->to('my@email.com')->from('some@email.com')->subject('Message Subject')->body('Message Body')->send(); } This is just to test email sending period. (The to and from emails are actually different ones that I have access to.) I've tried several times to submit inquiries and am not getting anything in spam or anywhere. I'm using XAMPP on OS X. I know email is complicated and not exactly a ProcessWire matter but do you guys know how I might be able to troubleshoot or resolve this? Surely others here have experience using wireMail() on similar setups... Thanks much. Link to comment Share on other sites More sharing options...
adrian Posted January 12, 2015 Share Posted January 12, 2015 Try this: wireMail('my@email.com', 'some@email.com', 'Message Subject', 'Message Body'); or $mail = wireMail(); Also, make sure your php mail function is available and working - likely it isn't on a local dev machine. So install and set up one of the SMTP options: http://modules.processwire.com/modules/wire-mail-swift-mailer/ http://modules.processwire.com/modules/wire-mail-smtp/ 4 Link to comment Share on other sites More sharing options...
hellomoto Posted January 15, 2015 Author Share Posted January 15, 2015 Well I have WireMailSmtp enabled and it says my settings appear to work correctly... so now I'm testing my php mail. Do my WireMailSmtp SMTP settings need to match my server/php settings? Link to comment Share on other sites More sharing options...
horst Posted January 15, 2015 Share Posted January 15, 2015 No, you need to give it your email account credentials as you do with your favourite local Emailclient. It uses libs that tests and establishes connection to your account at a smtp provider (like gmail for example) and handles over the messages to it. It has nothing to do with your settings in the php.ini. Settings in php.ini are related to the php mail() function only! Link to comment Share on other sites More sharing options...
hellomoto Posted January 16, 2015 Author Share Posted January 16, 2015 Oh so then the SMTP plugins are separate of PHP mail? Sounds good! But if that's the case, and my settings are supposed to be set up correctly in WireMailSmtp, why won't my email test work? Link to comment Share on other sites More sharing options...
cstevensjr Posted January 16, 2015 Share Posted January 16, 2015 What email provider are you sending your emails from and what email provider are you using as the To: address? Link to comment Share on other sites More sharing options...
Pierre-Luc Posted January 17, 2015 Share Posted January 17, 2015 I would also greatly suggest you use this to test sending your email : http://www.mail-tester.com. It will also provide suggestions on how to improve your mail delivery systems to prevent outbound emails to be seen as spam. 3 Link to comment Share on other sites More sharing options...
hellomoto Posted October 9, 2016 Author Share Posted October 9, 2016 Pierre-Luc: so all else the same, just mailto that email address? cstevensjr I was sending to a gmail email, or just performing the check on save, from another one set up with seemingly correct configuration... Link to comment Share on other sites More sharing options...
Pierre-Luc Posted October 18, 2016 Share Posted October 18, 2016 @hellomoto yes, that will give some guidance. 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