Link to home
Start Free TrialLog in
Avatar of MrG
MrG

asked on

Problems with "Mail" program

-->I'm using the following snippet of script to send mail from a form:

sub sendthemail {  # Send Article Posted To Administrator
  if ($sendmail == 1) {
    open (MAIL, "|$mailprog $host") || die "Can't open $mailprog!";
    print MAIL "From: $email\n";
    print MAIL "Subject: $title Message sent \n";
    print MAIL "Reply-To: $email\n\n";
    print MAIL " The following e-mail has been sent to all subscribers.\n";
    print MAIL "Dated  : $long_date\n";
    print MAIL "Subject: $subject\n";
    print MAIL "======================================================\n";
    print MAIL "$email_body\n";
    print MAIL "======================================================\n";
    close (MAIL);
  }

-->BUT when the message is received the From, Subject and Reply-to headers that I wanted have been included in the message as ordinary text:

Subject:
  Date: Mon, 8 Sep 1997 22:24:39 +0100
  From: Nobody <nobody@compsoc.man.ac.uk>
    To: MUUCU@bigfoot.com


From: MUUCU.WebMaster@bigfoot.com
Subject: MUUCU Mailing Archive Message sent
Reply-To: MUUCU.WebMaster@bigfoot.com

 The following e-mail has been sent to all subscribers.
Dated  : September 08, 1997 at 22:24:38
Subject: TEST RUN1002
======================================================
TEST RUN
======================================================

-->So What can I do to fix this?
Avatar of MrG
MrG

ASKER

Edited text of question
Avatar of ozo
That depends on your $mailprog
If it's /usr/lib/sendmail on a standard unix system, I'd have expected the above to work.
If it's some other program, you may need to check its documentation.
I had the same problem - with sendmail on Unix, BTW.

Solution? Just add the following line after the open() stuff:

print MAIL "Mime-Version: 1.0\n"

Hope this works for you, as well.

Rgds, julio
julio, what version of sendmail was this that required "Mime-Version: 1.0\n" ?
Avatar of MrG

ASKER

As I said at the top of the question, it was not SENDMAIL that I am using it was mail, but I've got SENDMAIL installed so It's working okay with OZO's suggestion!
Sorry, so many things called mail or Mail that it wasn't clear whether
that was a name or a description of $mailprog
So, if that comment got it working for you, will you take
using /usr/lib/sendmail as the answer?
(I don't want to submit it as an answer just yet, to give julio
a chance to answer my question without having to pay points just to come
back to this discussion:-)
 

Hi ozo,

i cannot guess which version of sendmail i'm running;
just can tell that it's on a Digital AlphaServer running OSF1 V4.0 386.

Cheers, julio

P.S.

hey, Mr G., "using the following snippet of script to send mail from a form" is what i could not see at the top of your question?
I'm not familiar with that system (but I thought they supported V8 sendmail)
Can you tell anything from Received: headers, or sendmail -d?

(Ok, Thanks for the use of your question thread MrG,
I'll let you take it back now:-)
 Mr Ozo ;)

in fact, i've made a mistake; it was not for headers that i had to add that line, it was for attachments to work.

I.e., i had setup a CGI to send back a gif to a client, via mail, but the attachment was garbage when read with Eudora or on a Mac.
I didn't investigate too much on which exact versions of Eudora or MacOS caused the problem.
Since that modification, anyway, everybody has been receiving good attachments.

-julio
Ah, that makes much more sense now, thanks for the clarification.
ASKER CERTIFIED SOLUTION
Avatar of ozo
ozo
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If you are unsatisfied with the answer, did you have a furthur question?

ozo -


In your script I see that you are not designating a "To;" ahead of your "From:", "Reply-To:", etc.

Try putting:

print MAIL "To: $CONFIG{'recipient'}\n";

Ahead of your line:

print MAIL "From: $email\n";