How to create an unsubscribe link via mail in simplenews?
You need to use token_replace.

Try this:

&lt;?php
$newsletter = simplenews_newsletter_load($node-&gt;nid);
$context = array(
  'category' =&gt; simplenews_category_load($newsletter-&gt;tid),
  'simplenews_subscriber' =&gt; simplenews_subscriber_load_by_mail($mail)
);
print token_replace('[simplenews-subscriber:unsubscribe-url]', $context, array('sanitize' =&gt; FALSE))';
?&gt;


You should get a url like so: http://example.org/newsletter/confirm/remove/c453d5e25d2t10

That thing in the end is an hash, built in simplenews_token() (simplenews.tokens.inc).

Update: I updated my answer to show how you can get the correct variables from simplenews. Taken from simplenews_node_view() (in simplenews.module).