Google Answers Logo
View Question
 
Q: PERL SENDMAIL question (unwanted exclamation marks) ( No Answer,   0 Comments )
Question  
Subject: PERL SENDMAIL question (unwanted exclamation marks)
Category: Computers > Programming
Asked by: marcfest-ga
List Price: $10.00
Posted: 27 Jan 2004 12:53 PST
Expires: 28 Jan 2004 15:59 PST
Question ID: 300844
Hello -

The "smartsend" perl function below sends out emails, however, due to
a SENDMAIL peculaliarity, long lines show up with unwanted exclamation
marks. I read somewhere that adding
Encoding = 'quoted-printable'
may fix this but I don't know how to add it to the function.

I'm looking for the function below to be altered so that it does not
insert unwanted exclamation marks anymore when sending out emails
containing long lines.

Please post the complete, altered function as the answer to this question.

Thank you.

Marc.

# perl function:

sub smartsend {
    my ($recipient, $sender, $subject, $textonly, $richhtml)=@_;
    my $sendmail = "/usr/lib/sendmail -t";
    my $email = <<THE_EMAIL;
From: $sender
To: $recipient
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="_jkkdsffds32432dlkjifewks_"; 
Subject: $subject

--_jkkdsffds32432dlkjifewks_
Content-Type: text/plain; charset="iso-8859-1"

$textonly

--_jkkdsffds32432dlkjifewks_
Content-Type: text/html; charset="iso-8859-1"

$richhtml

--_jkkdsffds32432dlkjifewks_--
THE_EMAIL


    open(SENDMAIL, "|$sendmail") or die "Cannot open $sendmail: $!";
    print SENDMAIL $email;
    close(SENDMAIL);
}

Request for Question Clarification by bookface-ga on 27 Jan 2004 14:43 PST
You would need to modify your sendmail.cf to include that line,
assuming that would be sufficient to fix your problem.

Some information here:
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=dpenejan8i.fsf%40ozone.fmi.fi

Notably:
Sending arbitary long lines without munging requires ESMTP's
BINARYMIME extension/option. Sendmail does not support this
experimental protocol.


Would an acceptable answer be to provide the following code (or modify
it to fit your given function) which does not use sendmail?

http://www.cs.cf.ac.uk/Dave/PERL/node180.html

Clarification of Question by marcfest-ga on 27 Jan 2004 16:02 PST
I need to work with the current function. If modifying sendmail.cf can
fix the problem *without* any unwanted side effects on other program
that use SENDMAIL, that will be an acceptable fix. But I'd need
precise instructions on where how and where inside sendmail to makes
changes, and how to restart it, if needed.

Not quite sure what you mean by "assuming that would be sufficient to
fix your problem". It will be sufficient if the result is no more
unwanted exclamation marks or other unwanted effects inside the
emails. Thank you.

Request for Question Clarification by majortom-ga on 28 Jan 2004 06:32 PST
How long are your "long" lines? Does the problem affect the $textOnly
part of the message, or is it only affecting the HTML part of your
message? Have you considered inserting line breaks between some of
your HTML tags, as in many cases this has no unwanted visual effect on
layout?

Clarification of Question by marcfest-ga on 28 Jan 2004 07:09 PST
I thought I had already closed this question. I solved the problem via 

$richhtml =~ s/(.{0,200}\S+)\s+/$1\n/g;

Thank you.
Answer  
There is no answer at this time.

Comments  
There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy