Harmster Posted March 12, 2014 Share Posted March 12, 2014 Hey, [NOTE] I have no idea if there's a better way, already a module that does the same or slightly different I just made this and I love to share this in case someone needs it! Onto the intro: every time I use the PHP Mail() function I find myself frustrated in the way I receive these e-mails so I found a library PHPMailer that lets you use SMTP fairly simple and because I love processwire I made this into a module Get it here: Github Basicly you use it almost the same as the PHP mail function, but this time you setup your SMTP (I've tested it with gmail) and call a method called send() on $phpmailer. Here's settings for gmail: - security: tls - port: 587 here's a example of usage: $subject = 'test'; $message = "Test message"; $r = $phpmailer->send($subject, $message, array($user->email => $user->first_name. " " .$user->last_name)); Arguments: - Subject: string - Message: string(html or whatever) - Recipient: array(email:string => name:string) - Attachment: array(path:string) !OPTIONAL It returns a 1 on success and an error string on failure. Use it, or don't. See you all around 4 Link to comment Share on other sites More sharing options...
kongondo Posted March 12, 2014 Share Posted March 12, 2014 Thanks for this Harmster. There has been a great deal going on regarding a mailing class, etc. Have a look at this thread: http://processwire.com/talk/topic/5693-new-module-type-wiremail/ ProcessWire now has a new mail base class that you can use with other mail classes. See Horst (WireMailSmtp) and Teppo's (WireMailSwiftMailer) for instance...You might want to make use of the new base class in your module.. 2 Link to comment Share on other sites More sharing options...
ceberlin Posted December 27, 2016 Share Posted December 27, 2016 There was a security alert on Christmas about PHPmailer (older than 2.5.18): https://legalhackers.com/advisories/PHPMailer-Exploit-Remote-Code-Exec-CVE-2016-10033-Vuln.html 2 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