Author Topic: Unsubscribe when someone replies to my follow-up  (Read 9401 times)

Charybdis

  • Posts: 31
    • View Profile
Unsubscribe when someone replies to my follow-up
« on: May 14, 2007, 07:52:44 am »
Dear Dean Wiebe,

this question is not so close to listmail, but I hope you will be able to give me some suggestion.

I want to implement this:
joe@gmail.com is subscribed to my list, and Joe receive one follow-up from me. When Joe replies to this followup with the joe@gmail.com address, then I want to automatically unsubscribe the joe@gmail.com email from list.

I think I need some CGI script to check an email account for incoming messages, then in some way unsubscribe addresses.

But I also need to read manually the incoming e-mails, because it can contain important infos. But in addition unsubscribe all incoming e-mail address, who replies to my follow-up.

Please give me suggestion how to do this.

Best regards.

Charybdis

  • Posts: 31
    • View Profile
Unsubscribe when someone replies to my follow-up
« Reply #1 on: May 15, 2007, 12:12:40 pm »
... no suggestions?  :(

DW

  • Administrator
  • Posts: 3787
    • View Profile
    • https://legacy.listmailpro.com
Unsubscribe when someone replies to my follow-up
« Reply #2 on: May 16, 2007, 08:24:00 am »
Greetings,

Were you able to get bounce.cgi working on your server?  This could be set up with a .cgi script similar to the remove script previously included with ListMail (but removed because people often subscribe with email addresses that cannot be easily sent "from")

The script is set up just like bounce.cgi, with an email forwarder forwarding email to the CGI script.  The code would need to be modified, however, to email you the users' reply if any.
Code: [Select]
#!/usr/bin/perl
# ListMail remove.cgi - Unsubscribe by email.
#
# You must configure this script for it to work.
#
# Place the script in your "public_html/cgi-bin" directory.  You may need multiple copies of
# this script with different filenames / email alias addresses if you want to remove users from
# individual lists or different sets of lists.  Alternately, you can just specify all and the
# user will be removed from all lists with 1 email.

# SET this to your ListMail URL, NO trailing slash
$listmail_url = "http://www.DOMAIN.com/mail";

# SET the variable $list to one of the following:

# single list
# $list = '1';

# multiple lists
# $list = '1,3,2';

# all lists (default)
$list = 'all';

# usually works as default (may be /usr/local/bin/wget or other)
$http_program = "/usr/bin/wget -O - " . $listmail_url . "/remove.php";

# begin script

# encode function
sub encode {
  my $str = shift || '';
  $str =~ s/([^\w.-])/sprintf("%%%02X",ord($1))/eg;
  $str;
}

# get piped message
$email = '';
while($line=<>){
 $email = $email . $line;
}

if($email){
 # process msg, grab email address and first / last name, if possible
 # find To:
 $searchstr = 'From: ';
 $strpos = index($email,$searchstr);

 if($strpos>=0){
  $thestr = substr($email,$strpos+length($searchstr),length($email));
  $npos = index($thestr,"\n");
  if($npos>=0) {
   # get email
   $thestr = substr($thestr,0,$npos);
   $lbpos = index($thestr,'<');
   if($lbpos>=0){
    $rbpos = index($thestr,'>');
    $em = substr($thestr,$lbpos+1,$rbpos-$lbpos-1)
   } else {
    $justmail = 1;
    $em = $thestr;
   }
   # check for name spaces
   $spos = index($thestr,' ');
   if($spos>=0) { $justmail = ''; } else { $justmail = 1; }

   if($justmail ne 1){
    # get name
    $name = substr($thestr,0,$lbpos-1);
    # strip quotes
    $name =~ s/\"//g;
    $spos = index($name,' ');
    if($spos>=0){
     $fn = substr($name,0,$spos);
     $ln = substr($name,$spos+1,length($name)-$spos-1);
    }
   }

   # sign up
   $sys_cmd = $http_program . "\\?cgi=1\\&list=$list\\&email=$em";
   if($fn ne '') { $sys_cmd = $sys_cmd . "\\&fname=$fn"; }
   if($ln ne '') {
    $ln = encode($ln);
    $sys_cmd = $sys_cmd . "\\&lname=$ln";
   }
   system($sys_cmd . " > /dev/null 2> /dev/null");
   # notify in php
  }
 }

}

I would be willing to assist with the code for as low as $35, the cost of a server analysis from http://listmailpro.com/support

Regards
Dean Wiebe
ListMailPRO Author & Developer - Help | Support | Hosting

Charybdis

  • Posts: 31
    • View Profile
Unsubscribe when someone replies to my follow-up
« Reply #3 on: May 16, 2007, 03:05:20 pm »
Thank you very much for suggestion. Yes, I will need your assist.

But I were unable to set up the cgi scripts. On my host I have Direct Admin (http://www.directadmin.com/), and Debian Linux.

But on Direct Admin there is only the forward e-mail to another e-mail option, not to forward e-mail to script.

So, if I were need your help, then I were pay $70, because of server analysis? Or can you please give me suggestion how to setup cgi scripts in such an environment?

DW

  • Administrator
  • Posts: 3787
    • View Profile
    • https://legacy.listmailpro.com
Unsubscribe when someone replies to my follow-up
« Reply #4 on: May 16, 2007, 06:46:18 pm »
$35 will be fine, I think I can solve your CGI problem immediately.  DirectAdmin uses Exim I believe, and it could be as easy as setting up a line in /etc/aliases, ie:
Code: [Select]
bounce@example.com: "/path/to/web/cgi-bin/bounce.cgi"
and/or
Code: [Select]
step2@example.com: "/path/to/web/cgi-bin/custom-remove.cgi"
(Tip: run "newaliases" after adding entries to /etc/aliases)

I can set this all up for you with SSH shell "root" access to the server - is this a VPS (virtual/shared dedicated server)?

Please include all required access information (Control panel, SSH shell, FTP, ListMail).  You can start your request here:
http://listmailpro.com/support?t=analysis

I should have your script completed within 24 hours, as I understand it it will remove the user and email you any reply.  Note you may also be able to use ListMail's "Remove Notification" to send you all of the (former) user's ListMail data.

Regards
Dean Wiebe
ListMailPRO Author & Developer - Help | Support | Hosting

Charybdis

  • Posts: 31
    • View Profile
Unsubscribe when someone replies to my follow-up
« Reply #5 on: May 17, 2007, 03:33:07 am »
Thank you. My server has huge problems right now (2 hard drives terminated), can you do the work on monday?

No, it is not VPS, only shared hosting. I think I do not have SSH shell access, only direct admin and ftp access. Then what can we do?

Yes, my wish is to remove user when replies to my follow-up. BUT then send me the original email.

Is it secure to throw out all my access data?

DW

  • Administrator
  • Posts: 3787
    • View Profile
    • https://legacy.listmailpro.com
Unsubscribe when someone replies to my follow-up
« Reply #6 on: May 17, 2007, 10:16:11 am »
Quote
Can you do the work on monday?

Yes of course - I work most days. You can start the request whenever you are ready.
Quote
No, it is not VPS, only shared hosting. I think I do not have SSH shell access, only direct admin and ftp access. Then what can we do?

We may need to have your host manually enter the required lines in /etc/aliases.  You may want to contact them about the possibility of them doing this for you.  I should still be able to develop the script with my own test installation and then forward instructions for your host.
Quote
Is it secure to throw out all my access data?

To the forum, no.  You should only submit your sensitive data through a request at http://listmailpro.com/support (which uses SSL encryption).

Regards
Dean Wiebe
ListMailPRO Author & Developer - Help | Support | Hosting

Charybdis

  • Posts: 31
    • View Profile
Unsubscribe when someone replies to my follow-up
« Reply #7 on: May 17, 2007, 10:36:41 am »
Then I needn't send the access informations, because we cannot reach etc/aliases. Can you then give me instructions, and I will forward it to my host?

Then I can upload the cgi scripts, is it ok?

I think, that if you have succeed in setup cgi scripts on a Linux server, then it will be no difference.

DW

  • Administrator
  • Posts: 3787
    • View Profile
    • https://legacy.listmailpro.com
Unsubscribe when someone replies to my follow-up
« Reply #8 on: May 17, 2007, 11:39:36 am »
You're right - I don't really need access at all.  Please start a request.  Simply enter dummy information, such as a hyphen, for each required field and include a link to this post in the Notes so I can match the order to your script.

If you want to test whether it's even possible to do this on you server use the instructions I sent previously:

1. Configure (to contain your LMP URL) and upload bounce.cgi
2. Ask your host to add this to "/etc/aliases"
Quote
bounce@example.com: "/path/to/web/cgi-bin/bounce.cgi"

3. and run "newaliases"

Regards
Dean Wiebe
ListMailPRO Author & Developer - Help | Support | Hosting

Charybdis

  • Posts: 31
    • View Profile
Unsubscribe when someone replies to my follow-up
« Reply #9 on: May 18, 2007, 07:56:20 am »
It is a good idea to test whether it is possible or not.

It must be done with custom_remove.cgi, too?



Code: [Select]
follow.up.sender@example.com: "/path/to/web/cgi-bin/custom_remove.cgi"

and run newaliases

follow.up.sender@example.com = my sender address as specified in Listmail?

DW

  • Administrator
  • Posts: 3787
    • View Profile
    • https://legacy.listmailpro.com
Unsubscribe when someone replies to my follow-up
« Reply #10 on: May 18, 2007, 09:44:29 am »
Yes, forwarding email to the custom script will look similar to as you describe and yes, the send email will need to be updated as you mentioned.

I recommend testing with bounce.cgi first.

Regards
Dean Wiebe
ListMailPRO Author & Developer - Help | Support | Hosting

Charybdis

  • Posts: 31
    • View Profile
Unsubscribe when someone replies to my follow-up
« Reply #11 on: May 29, 2007, 02:56:25 am »
Quote from: "DW"
You're right - I don't really need access at all.  Please start a request.  Simply enter dummy information, such as a hyphen, for each required field and include a link to this post in the Notes so I can match the order to your script.

If you want to test whether it's even possible to do this on you server use the instructions I sent previously:

1. Configure (to contain your LMP URL) and upload bounce.cgi
2. Ask your host to add this to "/etc/aliases"
Quote
bounce@example.com: "/path/to/web/cgi-bin/bounce.cgi"

3. and run "newaliases"

Regards


Dear Dean Wiebe,

is there any alternative way to configure cgi scripts under direct admin, and under Debian Linux? (without SSH)

It is really hard to find a host, where this cgi configuration is easy, or possible.

DW

  • Administrator
  • Posts: 3787
    • View Profile
    • https://legacy.listmailpro.com
Unsubscribe when someone replies to my follow-up
« Reply #12 on: May 29, 2007, 03:24:35 am »
Unfortunately I do not know an alternative method for DirectAdmin.  You might try Google for "pipe email to script directadmin" or "email pipe directadmin"

The only hosts I know of that support email forwarding to CGI (aka. pipe to program) without admin intervention is any cPanel-based host (there are a lot of these, including ThirdSphere) and Host4Profit or DreamHost, as mentioned in the host review post here.

Regards
Dean Wiebe
ListMailPRO Author & Developer - Help | Support | Hosting

Charybdis

  • Posts: 31
    • View Profile
Unsubscribe when someone replies to my follow-up
« Reply #13 on: June 03, 2007, 01:39:22 pm »
Dear Dean Wiebe,

you said you will assist with the code for 35$. So I will need your help, but I have a question.

What if the reply address differs from the recipient address? For example, I send the followup to joe@example.com, but then john@example.com replies to this message?
 The script should handle this.

I could include the original e-mail address in the body of the followup, so the cgi could grab this e-mail address from the reply's body, then remove this address. Is this a good solution, or you have a better?

If you agree, I will start a request for 35$, but I need also this feature.

DW

  • Administrator
  • Posts: 3787
    • View Profile
    • https://legacy.listmailpro.com
Unsubscribe when someone replies to my follow-up
« Reply #14 on: June 04, 2007, 01:16:50 am »
If you can show me an example of how a live generated "Remove Link" looks in your messages (changing the Remove Links options can affect this...) I can parse that line for the users' ListMail ID... :)

Have you confirmed that you can forward email to CGI scripts on your host?

Regards
Dean Wiebe
ListMailPRO Author & Developer - Help | Support | Hosting