SilverStripe SMTP authentication instead of PHP mail() function - php

My hosting provider (webhosting.uk.com) for security reason has disabled the PHP mail() function requiring to update our code using a SMTP authentication. I have no idea how to change the code, I suppose it's in the sapphire folder? At the moment the contact form on my website doesn't send the email to the recipient and the newsletter module fails to send... Can anyone help me in this, or point me in the right direction?
Thanks in advance

Don't change the code in core - it will make updates complicated and isn't necessary.
There's a dedicated module for this problem: https://github.com/xeraa/silverstripe-smtp
Disclaimer: I'm the author, but it's free + BSD licensed so there's no reason for not using it.

I have the same issue with a site I maintain at webhosting. I've not yet resolved the issue (lack of time), but webhosting did provide an example way to use SMTP authentication for email sending.
This is the link the mail I got from webhosting: http://taverham.webhosting.uk.com/auth.txt. That asks you do download a zip file from here, which contains php script code that will allow you to use SMTP authentication.
Hope that helps!

Think I found the solution: http://www.silverstripe.org/general-questions/show/7991

Related

How to send emails using php via a localhost(MAMP) on Mac?

I am new to PHP and I am trying to build a form that will be used to send emails. The form has two inputs, one is for user email and the other is for the message. Once the user clicks on submit button an email is supposed to be sent to me.
I saw the PHP mail() function but I am not able to use it because I am on a local server that is MAMP and I am using Mac OS 11.4v,
PHP version: 7.4.12 ,
Apache Port: 80 (I don't know if this information will help but still I will provide it in case it does)
I saw various ways on the web to solve this problem but every solution is kind of different I am don't know what is right at this point. I know there are some changes to be made in the files of the MAMP folder but I don't know what are the steps and what will work.
Can anybody please help me out? Thanks in advance!
I've used a 3rd party SMTP service to send emails from local instances. I use Sendgrid since it's free for their lowest plan. The drawback is that you'd need to build the API integration with Sendgrid, so it's more work on that front.
I've also used Mailhog to intercept emails locally.
If you are developing WordPress locally, then the Sendgrid integration is ultra easy - just download the Sendgrid integration plugin.
I used the PHP mailer library and it worked.
Here is the link for the library: https://github.com/PHPMailer/PHPMailer/tree/5.2-stable
Go for the stable version of the library which is 5.2-stable. The instructions to use the library are provided in this GitHub link.
Remember you need a Gmail account from which you will be sending emails. You have to provide an ID and password for the same in the library. Also, you need to make this Gmail account less secure. Just search on google:- 'less secure apps' and you will find the link to make your account less secure.
For reference:- check out this youtube video:- youtube.com/watch?v=0luMSSesJBA

How to Send Email from wordpress website using PHP and without any plugins?

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.

Need to run SMTP on localhost with October CMS / Laravel

I have an instance of October CMS running on my localhost, and I need to send emails to various internal addresses (within the company I work for) via the Mail configuration using SMTP Method (as requested by my superior). I had emails working fine using the PHP Mail Method with the addition of SSMTP to my system. However, for me to do this I was tunneling emails through my personal Gmail account, and we certainly don't want to do that! (By "we" I really mean "I") So, if anyone has any clues as to how I should go about this, I would greatly appreciate it!
First of all, create your email server.
Windows -> hMailServer
Others systems (Linux) : there are many options, find your best. Google it.
After, foward your port. Check this website, many ads.
Finally, October part. Go to config/mail.php. And change your SMTP server setting to yours.
But, I don't recommand this. Why? Because fowarding port can be dangerous, sometimes. You also have to turn your computer on if people want to reply you.
Instead, use your compagny mail server and change the setting to your compagny. Simple as that (-:.
Hope this help,
FelixINX

Mail going to Spam in gmail

I have a running store, but my emails are going to spam.
I have Joomla 1.7 installed and configured it tu use proper SMTP auth.I have the site running on a shared host.
I have tried to search in email blacklists but it all comes clean.
Am I doing something wrong? Any ideas?
Thanks
You probably need to configure SPF records for the domain, You should contact your host and ask them to configure them..
I had this same problem on my web site. :)
This is complex issue, First of all, you should follow the following tips
Tell the people who receive the mails, why they get these mails (at the footer)
Give them explicit link to un-subscribe from this list (at the footer)
Make the subscribe process double opt-in, so after adding their mail, they should activate through a link sent to their mail
Also Read the following links that may help (You may need help from your server administrator)
http://en.wikipedia.org/wiki/Email_authentication
http://en.wikipedia.org/wiki/DomainKeys_Identified_Mail
http://mailchimp.com/about/authentication/
Finally, the best think to avoid your mails getting blocked is to make sure that your users want them .
Joomla 1.7, 2.5 and 3 all feature a mail file which sends the mail without the plaintext alternative, this was killing my sites. I had to add it manually to the core, please see Joomla mail goes to spam folder: how to add text/plain when sending HTML email?

Does the PHP mail() function work if I don't own the MX record

I'm not sure I'm using all the correct terminology here so be forgiving.
I just put up a site with a contact form that sends an email using the PHP mail() function. Simple enough. However the live site doesn't actually send the email, the test site does. So it's not my code.
It's a shared host and we have another site that has the same function that works perfectly, so it's not the server.
The only difference between the two is that the site that doesn't work just has the name server pointing to us and so the MX record never touches our server.
So my question is, could some one please confirm that the mail() function wont work if we don't have the MX record pointing to our server. Thanks
Yes. It will work just fine. I have a PHP script using the mail() function with the MX records set to Google Apps.
If the two scripts are on different hosts (it's a bit unclear from your post), then make sure that the host doesn't block some of the custom headers. I had issues with this when creating my script, but removing all but the From header fixed the problem.
Some hosts (Godaddy is the worst) block your use of sendmail and mail().
I generally use smtp to send emails from my php applications and with PHPMailer it's super easy. Many applications are using older versions of PHPMailer and sometimes updating it can help. It's also easy enough to add quickly to short scripts as well.
Hey guys thanks for the answers, it is really appreciated.
After ignoring the issue for a few months it has come up again, I did however find the answer to my problems.
Firstly, as you answers suggested, PHP and the mail() function were working as expected. The mail was getting sent.
The problem lies when the email is sent, it simply presumes that because its being sent from mydomain.com to *#mydomain.com email that the email itself is hosted on the same server, so it gets sent there instead and ignores the MX record.
OK it's a bit more complicated than that, but that is the general jist.
Edit:
Found a better version of the topic sendmail and MX records when mail server is not on web host.
The mail() function sends mail from the server hosting the script. Since many shared hosting providers host separate mail servers, and because the mail() function doesn't support any sort of authentication, many shared hosting providers block it.
If the site uses SPF, remember to include the sending site in your SPF record. For more info see here.
Yes, you could put in what ever you want in the 'from' field and it would still work.

Categories