Get answers quicker by searching

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

List Unsubscribe Header
  • Vote Up0Vote Down addactiveaddactive
    Posts: 46Sendy user

    Would it be possible to add a list unsubscribe header to emails sent from Sendy? I understand that this is a reputable thing for bulk marketing senders to use?


  • Vote Up0Vote Down angelimangelim
    Posts: 7Sendy user

    (+1) This is important, specially for hotmail and gmail

    It's really simple to set it up:

    # extract unsubscribe url

    $unsub_url = get_app_info('path').'/unsubscribe/'.short($email).'/'.short($subscriber_list).'/'.short($campaign_id);

    # add header

    $mail->AddCustomHeader("List-Unsubscribe: <mailto:".$from_email."?subject=Unsubscribe>, <".$unsub_url.">");

    After implementing, Hotmail will show the link to unsubscribe on its interface under the button Sweep. On Gmail the user has to click on the little arrow bellow the sender address and there will be a link to unsubscribe.

    I hope this helps.



  • What file needs to be edited?

  • Vote Up0Vote Down angelimangelim
    Posts: 7Sendy user


  • Vote Up0Vote Down BenBen
    Posts: 3,792Sendy support

    Hi @angelim,

    Thanks for your suggestion and the code. I realize Gmail does not 'click' the link included in the List-Unsubscribe header, it only sends an email in which you have to manually unsubscribe the user in Sendy. Hotmail does not even send an email or 'click' the unsubscribe link in the List-Unsubscribe link at all.

    Can you let me know what's the behaviour like on your side for both Gmail and Hotmail?



  • Vote Up0Vote Down SteveJSteveJ
    Posts: 16Sendy user

    @angelim: Thanks for the suggestion, but even a hard-coded version isn't working for us. Maybe it's not being picked up properly by PHPMailer?

    We've added this immediately before the $mail->Send(); line:

    $mail->AddCustomHeader("List-Unsubscribe: <>, <>");

    But it doesn't show up in the headers of the received mail. What am I missing? @angelim or @Ben - any ideas?

  • Vote Up0Vote Down BenBen
    Posts: 3,792Sendy support


    May i know which script did you add this in?

    If you're using a cron job to send emails, t should be scheduled.php. If you're not using cron, it should be /includes/create/send-now.php.


  • Vote Up0Vote Down SteveJSteveJ
    Posts: 16Sendy user

    Ah! That probably is the key. We are using cron! :)

  • Vote Up0Vote Down SteveJSteveJ
    Posts: 16Sendy user

    Ok - we're closer! Here's what I'm now including in scheduled.php:

     $mail->AddCustomHeader("List-Unsubscribe: <mailto:unsub+".$custom_fields_array[2]."".$email.">");

    Which ALMOST works -- it's showing up in the email header as:

    List-Unsubscribe: <>

    Custom field #2 is named "MD5" but it's spitting out "MD5:Text" instead of the actual value of the field for the user.

    Any ideas on how to spit out the actual value?

  • Vote Up0Vote Down SteveJSteveJ
    Posts: 16Sendy user

    Figured it out: custom_values_array instead of custom_fields_array :)

  • Vote Up0Vote Down angelimangelim
    Posts: 7Sendy user

    Hi @Ben and @SteveJ,

    Sorry for the delay. I don't know how to receive notifications for the threads I'm in.

    I've just tested out the unsubscribe buttons in both Gmail and Hotmail. Before now, I had just checked the options made available in their interface when adding the unsub header.

    Gmail ignored the unsub URL and only used the unsub email address(even when listing the url before the email in the header). It seems that some people were able to get it working with the link, though:

    When I click "Report Spam", Gmail also gives me an option to unsubscribe from the list: Unsubscribe and report spam. That also triggered the unsub email, which could be used as a feedback loop. As far as I'm aware, gmail doesn't support a standard feedback loop(Amazon can't pick it up), so this is a plus.

    My Hotmail interface is not in english so I'll try to translate it without actually confirming the right wording. Clicking on Sweep/Usubscribe will trigger a modal entitled: "Stop receiving this newsletter". Go to YOURWEBSITE website(linked to unsub url) to unsubscribe. If this sender sends another email in the meanwhile, we'll place it in the trash.

    Clicking the word "website" linked me to the unsubscribe url.

    I hope it helps.

  • Vote Up0Vote Down rarijararija
    Posts: 15Sendy user

    +1 to this feature, is another step to increase deliverabilty

  • Vote Up0Vote Down doleaguedoleague
    Posts: 23Sendy user

    +1 This will be a great feature indeed. Thanks

  • Vote Up0Vote Down sgilsgil
    Posts: 1Sendy user

    +1 from me too.
    Anything that aids deliverability by pleasing the big players in the email world gets my vote. I work a lot with small business owners. A single subscriber can bring in a lot of money (relatively speaking) for a small company. I am very impressed by Sendy. Many of my clients dream of being able to save the sorts of money that Sendy could save them. The addition of features such as that suggested above would make me more and more inclined to recommend it to them.

  • Vote Up0Vote Down spfspf
    Posts: 3Sendy user

    +1 I would love to have this feature without having to modify php files, because everytime i've to update sendy i've to reedit some php files

  • Vote Up0Vote Down spfspf
    Posts: 3Sendy user

    Hello Ben,

    I tried to include Angelim suggestion

    $unsub_url = get_app_info('path').'/unsubscribe/'.short($email).'/'.short($subscriber_list).'/'.short($campaign_id); $mail->AddCustomHeader("List-Unsubscribe: <mailto:".$from_email."?subject=Unsubscribe>, <".$unsub_url.">");

    in send-now.php but when I hit the send button sendy show sending... tag forever. If i hardcode it $mail->AddCustomHeader("List-Unsubscribe:,>"); everything works so I'm assuming is something when extracting the $unsub_url .

    Can you please help? Thanks

  • Vote Up0Vote Down clickbuildclickbuild
    Posts: 1Sendy user

    the get_app_info() function is not available in scheduled.php - so you need to hard code the first part of the unsub URL/ WIll be something like - 'http://yourdomain/[path-to-your-sendy]/unsubscribe'

  • Sorry, bit of a Noob here and configured Sendy today but already a big fan.

    Where should the code (mentioned by angelim) be placed in the file "includes/create/send-now.php"?

    Thanks BJ

  • I expected List-Unsubscribe-Header in as Sendy's releasenotes states: Added 'List-Unsubscribe' header (unsubscribe URL as value) to emails sent as 'campaigns' and 'autoresponders'. I sent a test to Gmail but couldn't find it. Am I looking in the wrong place?

  • Vote Up0Vote Down BenBen
    Posts: 3,792Sendy support

    Gmail decides whether to include 'unsubscribe' at the top. They have an algorithm to detect if an email looks like a newsletter, if it does then it will place the unsubscribe link at the top.

  • Vote Up0Vote Down AlexeyAlexey
    Posts: 1Sendy user

    Hi! It seems that in v2.0.1 "List-Unsubscribe" header is automatically added only in the sceduled (scheduled.php) case, but it is not added when you do not use cron (includes/create/send-now.php). It looks strange because [I guess] no one expects that there is any difference between instant and scheduled sending except time. Moreover, "List-Unsubscribe" is something useful, why not to add it to "instant" sending (includes/create/send-now.php) too?

  • Vote Up0Vote Down BenBen
    Posts: 3,792Sendy support

    @Alexey, thanks for bringing this up. I'll apply the same to the 'non cron job' sending script. Thanks.

This discussion has been closed.
All Discussions