且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

wordpress如何通过网站上的联系表单发送电子邮件?

更新时间:2023-02-25 10:11:11

默认情况下,WordPress使用名为mail()的PHP函数在主机服务器支持时发送邮件通知。某些服务器要求使用有效的SMTP帐户发送所有邮件。在这种情况下,主机提供商通常包含SMTP插件,因此您可以配置帐户凭据以从SMTP帐户发送邮件。激活后,插件会覆盖默认的WordPress mail()函数。


Hi guys,

When we create a wordpress website, it gives us the add a plugin for sending mail by filling a contact form.

My question is, how does wordpress able to do it, do they have a mail server that it gets all the data through the contact form and sends us an email?

My question might sound a bit dumm, but I really wonder how are they doing it?

Thanks for your help in advance!

Kind Regards,
Ozgur

WordPress, by default, uses a PHP function called mail() to send mail notifications if the host server supports it. Some servers require that all mail be sent using a valid SMTP account. In that case, host providers often include a SMTP plugin so you can configure your account credentials for sending mail from your SMTP account. When activated, the plugin overrides the default WordPress mail() function.