Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8823075
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T06:15:53+00:00 2026-06-14T06:15:53+00:00

i am facing small challenge but time is running and not a really perl

  • 0

i am facing small challenge but time is running and not a really perl guy, so any help is welcome. What I have is script that check all running processes and write the status in /tmp/error Then i have perl script to send email with attachement via external stmp but what i need is pierce of code that takes that /tmp/error and put that in the emails body so thre is not need for attachement. Here is what I found> this sends file as attachement but i need that in the body.

 #!/usr/bin/perl

use MIME::Lite;

# Set this variable to your smtp server name 
my $ServerName = "smtp.comcast.net"; 

my $from_address = 'me@comcast.net';
my $to_address   = 'me@hotmail.com';
my $subject      = 'MIME Test: Text';
my $mime_type    = 'text';
my $message_body = "Testing text in email.\n";

# Create the initial text of the message
my $mime_msg = MIME::Lite->new(
   From => $from_address,
   To   => $to_address,
   Subject => $subject,
   Type => $mime_type,
   Data => $message_body
   )
  or die "Error creating MIME body: $!\n";


# Attach the text file
my $filename = 'C:\tmp\test.txt';
my $recommended_filename = 'test.txt';
$mime_msg->attach(
   Type => 'application/text',
   Path => $filename,
   Filename => $recommended_filename
   )
  or die "Error attaching text file: $!\n";

# encode body of message as a string so that we can pass it to Net::SMTP.
my $message_body = $mime_msg->body_as_string();

# Let MIME::Lite handle the Net::SMTP details
MIME::Lite->send('smtp', $ServerName);
$mime_msg->send() or die "Error sending message: $!\n";

Please help

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T06:15:54+00:00Added an answer on June 14, 2026 at 6:15 am

    Just add the file contents to your $message_body, right?

    my $message_body = "Testing text in email.\n";
    {
      local $/ = undef;
      open FILE, "file" or die "...: !$";
      $message_body .= <FILE>;
      close FILE;
    }
    

    Be careful if that file is too big though.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am facing a small problem. As we all know, if you have more
I am new to django . I am facing a small problem but unable
I'm new to android development and I've developed a small app but I'm facing
I'm facing small difficulties with my Java server, basically it works, but only for
i am facing a small issue in sms in android application. I need help
We have been facing a small problem in MySQL procedure. We have placed some
I want to create a small database for my inventory but I have some
I am facing a small problem. I have a struct, which has a vector.
Here are the problems that I'm facing with a small jQuery script : In
I am facing a very basic problem. Some time small things can take your

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.