John Rudd's ms2cgp and cgp2ms

NTIN Page Guy pages at
Wed Dec 3 21:54:41 GMT 2003

Hello NTIN,

Strange, I posted this message hours ago and it just now appeared.

John pointed out that my fix below breaks messages that addressed to
multiple recipients.

 Wednesday, December 03, 2003, you wrote:

NPG> There seems to be a problem with cgp2ms and ms2cgp when a email
NPG> address contains an & sign.

NPG> For example
NPG> I send an email to jena&jema at where
NPG> is not a local domain.

NPG> The message goes out to mailscanner via cgp2ms

NPG> 4:03:35.73 2 ENQUEUERRULES [29540630] rule(MailScanner) action #0: launching external task:
NPG> [FILE]/usr/local/etc/cgp2ms
NPG> 14:03:35.84 2 ENQUEUERRULES [29540630] rule(MailScanner) discarded the message
NPG> 14:03:35.84 2 ENQUEUER-03([29540630]) discarded by Rules
NPG> 14:03:35.84 2 DEQUEUER [29540630] SYSTEM()jena&jemma at delivered

NPG> Then root@ gets the following email, the original
NPG> sender of the message gets no failure notice.

NPG> Failed to deliver to '<jena>'
NPG> address is blacklisted

NPG> I have fixed the proceeding problem, here is how I did it.

NPG> I found a bug in ms2cgp which was causing problems with email
NPG> addresses with & signs in them.

NPG> ms2cgp had the following lines, this caused a problem because the &
NPG> sign is a special character.

NPG>    # send the message off to CommuniGate Pro
NPG>    system("$CGPBIN/sendmail -i $rcpt < $msg");

NPG> Below is my fix, by inclosing the $rcpt in quotes I have convinced it
NPG> to accept special characters in email addresses.

NPG>    # send the message off to CommuniGate Pro
NPG>    system("$CGPBIN/sendmail -i \"$rcpt\" < $msg");

NPG> If you see any flaws in my logic, please let me know.

NPG> Best regards,
NPG> Robert B, NTIN                           mailto:pages at

Best regards,
Robert B, NTIN                           mailto:pages at

More information about the MailScanner mailing list