• Hello I am wondering if anyone can help with this. I am trying to run the wp-mailer from a php standalone file. I am using a php form which sumbits to a php file. and I would like to run the php mailer right there in the file but my understanding is i cannot since i am “outside of wordpress”; is it an easy thing to activate what I need so I can run the php mailer from within that file; does anyone know how to do that?

    Thanks, G

Viewing 3 replies - 1 through 3 (of 3 total)
  • You can use it like that. PHP Mailer doesn’t need to be connected to WordPress in any way to work. The main thing that you need to check is that you’re using the correct input names and you’ve got the right settings for it. The set-up instructions should come with the phpmailer script (it did last time I downloaded it), so that’s where to start.

    Thread Starter charismaarts

    (@charismaarts)

    Hello C:

    thanks for your input; i guess i should have been more specific; it is the “wp_mail” function; i ran the code on a wordpress page and the code worked just fine and sent the note exactly how it should; i then i tried to run the same code from a standalone php file and it did not work at all; that is what makes me think there is something else i need to do; does that make it any clearer?

    thanks, g

    Ahhh….. See, that makes a huge difference. You said before that you were only trying to use the phpmailer script, and if that was true you would be able to use it as a stand-alone script. That’s why no one would ever think that you’re trying to do it through wp_mail().

    The biggest question now is… Why are you trying to use wp_mail() anyway? You want a stand-alone script outside of WordPress, and phpmailer can do everything that you’re looking for – you will just need to do more set-up for it.

    If you do actually want to use wp_mail() and don’t mind that you need a pretty good chunk of other code loaded to get to that point, then include wp-blog-header.php in your PHP script, and you’ll be able to access all of the standard WP functions, but you won’t need to use the standard page/post output. You can do your processing, then redirect to which ever URL you want to.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘form to send email’ is closed to new replies.