I run a reasonably popular blog on WordPress and have a fair number of comments forwarded to me by the mail server currently sitting on my web server. However, I am in the process of moving to a new server where I do not want to run a mail server. For all my other site needs - user registration - I am doing this by forwarding all emails sent out by the system to a transactional mail service that handles email forwarding a whole lot better than my local mail server can.
I need to modify the WP code that alerts me by email each time there is a new comment on a post. I assume that this is being done via PHP's mail function or the like. I tried grep'ing all the *.php files on my WP blog for this but found little.
I am a competent PHP programmer so hacking the relevant WP PHP code to redirect all mails via my chosen transactional email provider holds little challenges for me. However, I would be most grateful to anyone who might be able to tell me just where WP does its email sending - perhaps it does not use the PHP mail function as I have been assuming.
Here is an answer to my own question.
After some more research I have eventually found this. As explained there WP sends its email via the wp_mail function which is located here.
I hope that this answer will help anyone else who wants to replace local mail server based email handling with forwards to an external mail/transactional mail service.
Related
I have a brand new small website hosted on a VM instance on Google cloud that makes use of a Bitmami LAMP stack running on Debian 10. I don't use WordPress, just regular HTML, but I cannot send any emails out.
I also have a similar website on shared hosting with Godaddy where an email form and its PHP script send emails just fine.
The website promotes the services of many small businesses. When visitors get interested in what my customers offer, they fill out an HTML form powered with a PHP script, and an email is sent to the right person regardless of their email service provider.
I've already installed Sendmail on Debian and edited the php.in file so that PHP's mail() function is finally returning TRUE, but emails are still not coming out.
I checked Sendmail's queue, and found that all test emails are being stored. All targeted email addresses used for testing belong to me. One on gmail, one on hotmail and one on a custom domain hosted on Siteground.
I don't need to receive emails. I only need to send emails of interested visitors to my customers.
My needs are simple, so I don't need to use a third-party service to send emails, but I'm stuck, and I don't know what to do next to achieve my goal.
I will appreciate any help. Thank you for reading.
I have been using GoDaddy to host a few websites I build in the past (Coded from scratch with HTML, CSS, PHP, JAVASCRIPT). Most of them are simple websites with the most complex code being the contact forms from which my clients receive emails. I have been using phpMailer to send these emails once a contact form is submitted.
Lately, I've built a new site for one of my clients and came across a problem where I could not get phpMailer to work - turned out I used a wrong Host, where it should have been the URL from cPanel I used my Domain name, simple mistake. However, in search of answers I contacted GoDaddy support and got connected to an "Email Expert(His Words)". He was unable to help me but keep repeating that phpMailer is trash and is really bad with sending emails from a live website. I do have few issues with phpMailer - main one being that emails can take upwards of 10 min to arrive in the mailbox after the form has been submitted, as well as the amount of time it takes to send an email (User click SEND from website and page will load for about 5-10 sec before re-directing to another page with success message).
My question here today is: What is the Best/Recommended and most used way to send email from a live website hosted by GoDaddy.
I came across posts from people who recommend PHP 'mail()' function. - I used it in the past but it has a lot of limitations like the lengths of the email, and for some reason, every time email containing any HTML was sent the email address would change to my cPanel username.
Any Information/Guided is appreciated as I would like to send my emails according to industry-standard rather than using 'Trash' Solutions.
The best way to submit emails through your website is using SMTP services like Sendgrid, Amazon SES, and Mailgun. There is a lot of services out there.
Here you can see a working example on how to send using Sendgrid and PHPMailer.
Am a Dot Net Developer.I know how to send emails in Dot Net and thats quite easy.Recently I started learning wordpress and unfortunately strucked at the beginning itself just because of e-mail sending process.
I Read many article and answers as well from stackoverflow.Everywhere in a php mail() function they are showing the few parameteres (i,e; email_from.email_to,subject,...etc according to syntax of mail() function.)As a developer i know that it is required to give the password to authenticate for sending email.Where to give that password?.
I tried lot of ways following different people words. I put all smtp details along with password in php.ini file andalso tried in wp-config.php file.
But no use Am not getting any error in the application and even am not getting mail sendiing too.
So now my question is to please let me know the process of setting application to send email using mail() function without any plugins.
And is there any way to debug the php website using breakpoints with any app?
Please help me to learn.
-Thanks in advance...
To clarify the Wordpress itself can send mail messages such as notification or "Forgotten Password" messages and they are all using the 'mail()' function. If you are encountering an issue that displays that the 'mail()' is not working, then either:
You do not have the SMTP Enabled on your hosting environment (which happens on free hosting plans);
or
You need to create a email address 'wordpress#domain.com' where you replace the '#domain.com' with your domain of course.
With the information above your Wordpress will be able to send it's (system/notification) messages without any issues, but if you wish to send Normal mail messages using the Wordpress I am afraid that is not possible without a Plugin.
Lots of answers here and elsewhere on Google for how to setup your WAMP or XAMP on localhost to send emails.
However for testing/developing, you mostly don't care about emails actually getting transmitted. You just want to check how they're formed, and whether the email picked up the correct settings and options.
So, I remember having this problem a few months ago and finding a solution/service which did this:
As soon as my PHP code triggered an outgoing email, it would present it as a real draft email in a new window in my email client (Outlook, as it happens). I could check the from/to/subject/body instantly and easily. Nothing actually got transmitted, and I didn't have to keep a bunch of inboxes open somewhere or worry about delays or junk folders.
Trouble is I can't remember how I set this thing up. It was either a service which I downloaded and installed or it was a tutorial on how to set this up in WAMP. It was possibly a WordPress plugin but I'm not sure. I am certain it was free.
Does anyone recognise this kind of setup for email testing in PHP?
Are you sure it is a PHP configuration and not a software?
I used a mail smtp 'catcher' that works as you describe.
I hope it could be useful for your interests: Test Mail Server Tool (http://www.toolheap.com/test-mail-server-tool/)
I'll be accepting Nacho's answer. For completeness ... following StackOverflow's Related questions and checking out some other answers, I see there's also a service called Papercut mentioned here, which I might also check out.
I have this job creating a simple website for someone, a website that
should be able to send mails to any email address, and I'm having some trouble
making it happen.
I'm using a simple free file server (cuccfree), but I don't have access to the server itself, only to upload files to the htdocs folder. I also configured a mail address in my server, but mailing only work to the server's email address (When ever I ask the php file on server to send the mail to Gmail/Yahoo and such, it does not work).
I've searched Google for an answer but kinda got lost..
I'd really like some help about this:
I'm ready to switch to a better file server service (whether it's free or not) that can support configuring mailing service that would work, and would be glad to hear some suggestions for one.
I'd also love to be guided of how to configure the mailing service on that server.
Also, when thinking about this, there's a good chance that my server's mails are being blocked by Gmail/Yahoo and such, otherwise anyone could have just set a mail server and send as much mails as they want.. so is that possible that this is my problem? is there any way to solve this and kind of confirm with the mailing companies that I'm a legit website?
I'm really not familiar enough with this topic' and would really appreciate some help.
Thanks in advance!