0

I have hosted a WordPress website and I am able to send emails from my website. I was wondering if I can reuse those modules and write a simple PHP to send email.

I am very very new to PHP so please share some pointers that I can refer to reuse the existing code.

I have tried simple mail function of PHP but looks like it requires lot of settings or configurations to be done before it's being used as it didn't work for me.

abdulH
  • 375
  • 1
  • 6
  • 19
  • 2
    `phpmailer` is a good starting point. It comes with a great documentation. So I would expect that _if_ you took a look at it you would ask some _specific_ question. – arkascha Sep 20 '16 at 17:38
  • This question isn't a duplicate of that question - it's not asking generically how to send email from PHP, it's asking how to send email using Wordpress' built-in functions for sending mail, given that they had failed to use `mail()`. This may also be a duplicate, but not of that question. This was quite annoying because it was closed while I was part way through writing a sensible answer that's quite different to the duplicate one... – Synchro Sep 20 '16 at 17:51
  • Posting my answer as a comment anyway: Wordpress has a built-in email sending function called [`wp_mail`](https://developer.wordpress.org/reference/functions/wp_mail/). This is a wrapper around PHP's mail function. You can expand that, retaining compatibility with things like Contact Form 7 (and any other plugins that use `wp_mail()`) to use PHPMailer using the [SMTP Mailer](https://en-gb.wordpress.org/plugins/smtp-mailer/) plugin. – Synchro Sep 20 '16 at 17:55
  • I don't know why it's if marked as duplicate. I didn't see any question where people asked about sending an email from PHP by using the existing WordPress code – abdulH Sep 21 '16 at 02:48
  • @Syncho I will explore wp_mail – abdulH Sep 21 '16 at 02:50

0 Answers0