with some code
How to add List-unsubscribe in the email in laravel 7
How to add List-unsubscribe in the email in laravel 7
You know the unsubscribe button we provide for each email we send, now email providers are asking us to provide the unsubscribe button in the header as List-unsubscribe so receivers can see the unsubscribe button right next to the title of the email
do you have a list?
when the recipient clicks a button to unsubscribe you get this, find them in the list and delete them or mark them not to recieve marketing
but you know this.
The implementation details vary - but you don't provide any context
@malcom Just use an actual mailing list provider like Mailchimp or Campaign Monitor.
Given you couldn’t be bother to read the Laravel mail docs, handling unsubscribes is a lot more involved than just adding a header to a message. You then have to actually handle a visit to that URL that will actually remove the recipient from whatever mailing list you’ve used.
If you send bulk emails from your web server and people mark it as spam, you’re going to end up getting that server’s IP address black-listed and then all emails sent from your application will automatically be marked as spam by every mail client. So just use a mailing list provider mentioned above instead of re-inventing the wheel and running the risk of getting your server’s IP address black-listed and upsetting your hosting provider.
@martinbean hi Martin, i couldn't find it in the documentation im person who alwsy go to documentation first i may miss it, i already built the entire unsubscribe system we been using for 2 years now and the unsubscribe button is already included in every marketing email we are doing good, the only thing im asking is how to make the unsubscribe button appear next to the subject, in email header "List-unsubscribe" like big tech are doing, i want tondo it laravel way, i noticed even laracast dont have that yet, pleas see this screenshot to understand me: ibb.co/cT0Yc76
@malcom You should worry more about upgrading from Laravel 7. Laravel 7 is years out of date and hasn’t been receiving security updates for some time. You should start upgrading now, as currently you’re three major versions behind. But Laravel 11 is due to be released soon, and then you will be four major versions behind.
Once you’ve upgraded, setting a header in mails is easy to find in the docs: https://laravel.com/docs/10.x/mail#headers
@martinbean thank you for the advice, you're right we are planning to rewrite the entire project with laravel 11 soon
@malcom You don’t need to rewrite. You just need to to upgrade. What are you going to do when Laravel 12 is released? Are you just going to “rewrite” every time a new major version is released?
If you upgrade as new versions are released, then you won’t find yourself five versions behind and in this situation where you think a “rewrite” is the solution instead of just stepping through each upgrade guide.
It takes around 15 minutes to upgrade. There’s literally no reason to do so when a new version is released. And there’s definitely no reason to be five versions behind.
Please or to participate in this conversation.