in reply to Re^3: Mail::Sendmail multiline Message
in thread Mail::Sendmail multiline Message

I will review the perlop and let you know how things go.
Ken

Replies are listed 'Best First'.
Re^5: Mail::Sendmail multiline Message
by sierpinski (Chaplain) on Mar 17, 2010 at 14:54 UTC
    This is how I'm sending the contents of a file via mail:

    ($HC is the file path to the file I'm going to send)
    open(MAIL, "|mail $EMAIL"); print MAIL "To: $EMAIL\n"; print MAIL "From: $mail_from\n"; print MAIL "Subject: $mail_sub\n"; print MAIL "Content-Type: text/plain; charset=\"iso-8859-1\"\n"; open(MESSAGE, "<", "$HC") or die "$!"; print MAIL <MESSAGE>; close(MESSAGE); close(MAIL);

    Update: I should note that the reason I don't use Corion's method listed above is because the file was already created before sending, and it seemed silly to me to read it all into a variable to send the variable. If the performance hit of reading/writing from a disk was already made, didn't seem much of a benefit to add more logic into the operation.
      Thanks for jumping in sierpinski as I too already have a file that I want to use as input to email.
      This is different from the Mail:Sendmail description. Can you expand on what the open statement is doing?
      Does each print write an entry to the mail(setup?)?
      When do you actually send the mail?
      I assume the Content-Type is just saying to send regular text mail.
      Ken