Sparkpost new requirement for TLSv1.1 or TLSv1.2 - What to do?

BassMan

Well-known member
I've seen you liked my other post about setting up another service, but I ran into the wall again because of the TLS 1.0. Really not sure what to do now...
 

BoostN

Well-known member
For XF 1.5, I've made the following changes and it seems to be working ok while testing with the endpoint sparkpost setup:

https://www.sparkpost.com/docs/tech-resources/tlsv1-0-test-hostname/

In the follow file: /library/Zend/Mail/Protocol/Smtp.php
Line 206

Change:
STREAM_CRYPTO_METHOD_TLS_CLIENT
to
STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT

So, your entire line will go from:
PHP:
if (!stream_socket_enable_crypto($this->_socket, true, STREAM_CRYPTO_METHOD_TLS_CLIENT)) {
to

PHP:
if (!stream_socket_enable_crypto($this->_socket, true, STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT)) {
I've tested over the past couple hours sending emails on a live XF 1.5 site, no problems yet. But, take this information with a grain of salt... :D
 

Filetrip

Active member
For XF 1.5, I've made the following changes and it seems to be working ok while testing with the endpoint sparkpost setup:

https://www.sparkpost.com/docs/tech-resources/tlsv1-0-test-hostname/

In the follow file: /library/Zend/Mail/Protocol/Smtp.php
Line 206

Change:
STREAM_CRYPTO_METHOD_TLS_CLIENT
to
STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT

So, your entire line will go from:
PHP:
if (!stream_socket_enable_crypto($this->_socket, true, STREAM_CRYPTO_METHOD_TLS_CLIENT)) {
to

PHP:
if (!stream_socket_enable_crypto($this->_socket, true, STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT)) {
I've tested over the past couple hours sending emails on a live XF 1.5 site, no problems yet. But, take this information with a grain of salt... :D
I did this too (I hadn't seen your post originally, so I had to fix up the code myself) and it seems to be working.
I hope this will help other people too
 

Moshe1010

Well-known member
How do you guys handle bounced emails with Soarkpost? As far as I know you can’t configure a bounced email there.
 

Moshe1010

Well-known member
Requires extra development work.
With their API? Have you done it?
I'm also receiving and error message when users use the "contact us" form:

Zend_Mail_Protocol_Exception: Email to <any email address> failed: 5.7.1 Unconfigured Sending Domain <gmail.com> - library/Zend/Mail/Protocol/Abstract.php:431

I configured TXT with my main domain name and a bounced email subdoamin with TXT+CNAME


I have bad experience with Amazon SES since many emails went to people's SPAM inbox, so I'm looking for alternatives. Sendgrid's public IPs were marked as spam, and Sendiblue doesn't support bounced emails.
 

Sim

Well-known member
With their API? Have you done it?
Yes, I have an addon which is almost ready for release which fully supports bounced email handling.

I'm also receiving and error message when users use the "contact us" form:

Zend_Mail_Protocol_Exception: Email to <any email address> failed: 5.7.1 Unconfigured Sending Domain <gmail.com> - library/Zend/Mail/Protocol/Abstract.php:431
You need to ensure that emails are sent using your actual domain - the "from" address you use in emails needs to be using your configured sending domain - not your gmail address.

Unfortunately, XF2.0 will set the from address to the user who fills the form. You'd need to over-ride this behaviour in an addon to send from an address using your own domain and set the user's email address in the ReplyTo header instead.

So basically, I don't recommend using SparkPost unless you have an addon which supports it.

I'm hoping to have mine ready within the next few weeks (it's done and I've been using it successfully for a few months now - just have a few little details to finish off before I release it publicly).
 

Moshe1010

Well-known member
Yes, I have an addon which is almost ready for release which fully supports bounced email handling.



You need to ensure that emails are sent using your actual domain - the "from" address you use in emails needs to be using your configured sending domain - not your gmail address.

Unfortunately, XF2.0 will set the from address to the user who fills the form. You'd need to over-ride this behaviour in an addon to send from an address using your own domain and set the user's email address in the ReplyTo header instead.

So basically, I don't recommend using SparkPost unless you have an addon which supports it.

I'm hoping to have mine ready within the next few weeks (it's done and I've been using it successfully for a few months now - just have a few little details to finish off before I release it publicly).
Would that add-on support XF 2 or 1.5 as well?

The gmail is user's configured contact us email provided by the user. If you click on the "contact us" button on your forum, you will see the "from" is user's defined email as registered to the system. Once the user tries to contact the administrator, I guess it thinks the email is sent from the user's email instead of the system email (spoofing?). That's why the error is registered, the question is if it's possible to avoid it.

Any other good email provider?
Sendgrid free plans have their IPs blocked by many providers. Sendinblue doesn't support bounced emails. Amazon SES have bad delivery reputation (from my testing at least). What's left? I need around 200-300 emails/day
 

Sim

Well-known member
Would that add-on support XF 2 or 1.5 as well?
I have a v1.5 version of it which I've been running in production for over 2.5 years now, but the bounced email handling support I build utilised a standalone Laravel application - which means that I can't really release it as an addon due to the complexity of setup and configuration.

My new v2.0 version of the addon is completely self contained and much simpler to set up - this is what I will be releasing publicly.

The gmail is user's configured contact us email provided by the user. If you click on the "contact us" button on your forum, you will see the "from" is user's defined email as registered to the system. Once the user tries to contact the administrator, I guess it thinks the email is sent from the user's email instead of the system email (spoofing?). That's why the error is registered, the question is if it's possible to avoid it.
Yes, this is the issue - you need an addon to over-ride this behaviour - the sender needs to be associated with your domain, so for the contact form, you use something like webmaster@yourdomain.com or info@yourdomain.com as the sender (any address associated with your configured sending domain), and have the user's email address set as the ReplyTo header.
 

radu81

Active member
Great news @Sim I also use Sparkpost but I don't handle the bounce emails.

I would like to know more about this add-on:
Using Sparkpost SMTP by default all emails are sent as non transactional emails, in this way when a user receives a notification email he can unsubscribe from his email client. That email address will be added to a suppression list visible in sparkpost account, and that user will never receive any email, including emails for changing password. If a notification email is sent as transactional email there is no way to unsubscribe from your email client.
The add-on you are developing include this option to send all email notifications as transactional email and newsletters as non transactional email?
Thank you in advance
 

Sim

Well-known member
The add-on you are developing include this option to send all email notifications as transactional email and newsletters as non transactional email?
Yes, and it respects the unsubscribe header too - although I haven't yet looked at the changes made here in XF2.1 to see how that affects what I'm doing.
 

radu81

Active member
Thanks for the add-on, but I switched to S3 since there isn't much convenience using Sparkpost now. They removed the free plan
 

BoostN

Well-known member
Thanks for the add-on, but I switched to S3 since there isn't much convenience using Sparkpost now. They removed the free plan
As did I.. it was the best option at the time but not anymore really. AWS is so cheap to send it's worth paying the small fee monthly.
 
Top