This assumes you are complaining about how the final email looks on the user's screen.
You are ultimately writing an html document, not plain text.
One way to deal with your problem is to switch from html to text. Another is to use html scripting.
You may want to learn very basic html scripting, one site is here:
This particular page deals with an html tag <br>. I cannot tell if you want line breaks
or not but place this tag at the end of each line of text you want displayed in email - each tag makes a line break.
It is up to you to find and use the various tags you require to get a correct format in the email.
Going text only is simpler from the programming point of view. Using /usr/bin/mailx instead of sendmail is also an easier approach.
Hi
A) I am able to send eMail using mailx from a UNIX ( solaris 8 ) host to my Outlook-email-ID : FName.Surname@Citigroup.com ( This is NOT my actual -eMail-ID). But in Outlook the "From :" eMail address is displayed as
" usr1@unix-host1.unregistered.email.citicorp.com " .i.e the words... (2 Replies)
I have a file like below :
bash-2.03$ cat neweamil2
Nigueel Rafferty
Thomas333 Middletonsss
Shwaita33 Ambasss
Zhi21 Caiss
Saluweh Husain
Nigueel Rafferty
Saleuikh Husainse
Desiyshskan Santhio
Need to convert firstname <space> lastname into email id .
For eg. (1st... (4 Replies)
Hi all,
Is there a way to perform the above, I am trying to strip out more than one space from a line, but keep the single space. See below output example.
My Name is test test2 test3 test4 test5
My Name is test test2 test3 test4 test5
Please note that the lines would contain... (7 Replies)
hi, i'm running openldap on ubuntu 10.04, creating new items with apache directory studio (windows version).
i use the ldap just as an address book to our small office (email clients are windows live mail 2009, 2011, microsoft outlook 2007 and 2010).
a. i cant see a list of the contacts,... (0 Replies)
I am very new to Linux and learning to script. This is for one of my servers at work that I have to keep track off as far as disk space and how it is used. I have tried to go line by line but little things keep chewing me up. I would appreciate any and all help or advice, and Mutt is installed on... (3 Replies)
This is my first time writing a script and Im having some trouble,
Im trying to use the top command to monitor processes and the amount of CPU usage they require, my aim is to get an email if a process takes over a certain percentage of CPU usage
I tried grep
Obviosly that hasnt worked,
Any... (8 Replies)
Hello i have a working script that sends me an email if system disk space is above 98%.
I would like to add an extra command to the if condition. If disk space is above 98% it would also add an output of cd /var/log && du -sBM * |sort -n 2>&1 |grep -v -e "0M" -e "1M" command to the email.
I'm... (2 Replies)
hi all members
I have a shell script to generate disk space usage email alert if threshold is more than 80 %, now the requirement changed to keep sending alert emails for every 5% incremental usage ........ Any help would be greatly appreciated.
ex - 80% , 85% ,90%,95%,100% we should get an... (6 Replies)
hi ,
i have written below piece of code to meet the requirement but i am stuck in the logic here.
the requirement are:
1) to send the sql out put to email body with proper formatting.
2) if count_matching = Yes then mail should triggered with the subject line ... (10 Replies)
Discussion started by: itzkashi
10 Replies
LEARN ABOUT DEBIAN
test::email
Test::Email(3pm) User Contributed Perl Documentation Test::Email(3pm)NAME
Test::Email - Test Email Contents
SYNOPSIS
use Test::Email;
# is-a MIME::Entity
my $email = Test::Email->new(@lines);
# all-in-one test
$email->ok({
# optional search parameters
from => ($is or qr/$regex/),
subject => ($is or qr/$regex/),
body => ($is or qr/$regex/),
headername => ($is or qr/$regex/),
}, "passed tests");
# single-test header methods
$email->header_is($header_name, $value, "$header_name matches");
$email->header_ok($header_name, $value, "$header_name matches");
$email->header_like($header_name, qr/regex/, "$header_name matches");
# single-test body methods
$email->body_is($header_name, $value, "$header_name matches");
$email->body_ok($header_name, $value, "$header_name matches");
$email->body_like($header_name, qr/regex/, "$header_name matches");
# how many MIME parts does the messages contain?
$email->parts_ok($parts_count, "there were $parts_count parts found");
# what is the MIME type of the firs part
my @parts = $email->parts(); # see MIME::Entity
$parts[0]->mime_type_ok('test/html', 'the first part is type text/html');
DESCRIPTION
Please note that this is ALPHA CODE. As such, the interface is likely to change.
Test::Email is a subclass of MIME::Entity, with the above methods. If you want the messages fetched from a POP3 account, use Test::POP3.
Tests for equality remove trailing newlines from strings before testing. This is because some mail messages have newlines appended to them
during the mailing process, which could cause unnecessary confusion.
This module should be 100% self-explanatory. If not, then please look at Test::Simple and Test::More for clarification.
METHODS
"my $email = Test::Email->new($lines_aref);"
This is identical to "MIME::Entity->new()". See there for details.
"$email->ok($test_href, $description);"
Using this method, you can test multiple qualities of an email message with one test. This will execute the tests as expected and will
produce output just like "Test::Simple::ok" and "Test::More::ok". Keys for $test_href are either "body", or they are considered to be
the name of a header, case-insensitive.
single-test methods
The single-test methods in the synopsis above are very similar to their counterparts in Test::Simple and Test::More. Please consult
those modules for documentation.
Please note that tests for equality remove newlines from their operands before testing. This is because some email messages have
newlines appended to them during mailing.
"my $ok = $email-"parts_ok($parts_count, $description);>
Check to see how many MIME parts this email contains. Each part is also a Test::Email object.
"my $ok = $email-"mime_type_ok($expected_mime_type, $description);>
Check the MIME type of an email or an email part.
EXPORT
None.
SEE ALSO
Test::Builder, Test::Simple, Test::More, Test::POP3
TODO
I am open to suggestions.
AUTHOR
James Tolley, <james@cpan.org>
COPYRIGHT AND LICENSE
Copyright (C) 2007-2008 by James Tolley
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or,
at your option, any later version of Perl 5 you may have available.
perl v5.10.0 2008-10-24 Test::Email(3pm)