Membership is FREE, giving all registered users unlimited access to every Acorn Domains feature, resource, and tool! Optional membership upgrades unlock exclusive benefits like profile signatures with links, banner placements, appearances in the weekly newsletter, and much more - customized to your membership level!

Email Forwarding / Cpanel

Status
Not open for further replies.

lee

Joined
Feb 11, 2013
Posts
290
Reaction score
7
I am trying to setup an alias on my domain ([email protected]) that will forward or send a copy to my Epson Connect email address ([email protected]) and make it easier for me and my family to remember the address and send documents to our printer from anywhere.

The problem is that when the email is forwarded it keeps the "[email protected]" email address as the "to" address and I get a bounceback from epson saying that printer does not exist. Is there a way to forward or send a copy of an email to that "[email protected]" and make sure that it is the "to" address in Cpanel?
 
How about something like the below? Simplest way I can think of to change the 'To' address on the email to keep the printer happy.

Code:
#!/usr/bin/perl
use strict;

# Real email address for the printer
my $email = '[email protected]';

my $sm;
open($sm, "|/usr/sbin/sendmail -t") or die("Got an error but can't open sendmail: $!");

my $in_header = 1;

while (my $line = <STDIN>) {
        chomp $line;

        # Empty line while in headers means end of headers
        if ($in_header && $line eq '') {
                $in_header = 0;
        }

        # Replace To: field if we're in headers
        if ($in_header && $line =~ m/^To: /) {
                $line = "To: $email";
        }

        # Pass through to sendmail
        print $sm "$line\n";
}

close($sm);

  • Change the address in line 5 for the real printer email address and save it as say printer.pl
  • Upload it to the root of your cPanel account
  • Give it execute permissions (700)
  • Delete your current printer@ forwarder
  • Add a new forwarder, and this time click 'Advanced Options', put printer.pl into the 'Pipe to a program' field and click the 'Add Forwarder' button to add it
  • Now send an email and hopefully it'll work!

The script is essentially a really trivial proxy to sendmail that'll modify the 'To' address on the way through.
 
  • Like
Reactions: lee
Status
Not open for further replies.

The Rule #1

Do not insult any other member. Be polite and do business. Thank you!

Members online

Premium Members

New Threads

Domain Forum Friends

Our Mods' Businesses

*the exceptional businesses of our esteemed moderators
General chit-chat
Help Users
  • No one is chatting at the moment.
      There are no messages in the current room.
      Top Bottom