LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-04-2022, 04:33 AM   #1
aikempshall
Member
 
Registered: Nov 2003
Location: Bristol, Britain
Distribution: Slackware
Posts: 902

Rep: Reputation: 153Reputation: 153
mail: leading white space in subject


I would like to introduce leading white space into the mail subject so it stands out in the mail list

Code:
 echo "Body text" | mail -s "                 subject text" -- alex
results in

Quote:
N 58 alex@mylaptop.vict 2022-12-04 10:16 15/522 subject text
where the leading spaces have been dropped

I could use a dot instead of space

Code:
 echo "Body text" | mail -s "..................subject text" -- alex
which results in

Quote:
U 59 alex@mylaptop.vict 2022-12-04 10:20 16/532 .................subject text
The leading dots have the desired effect to right justify the subject, I'd prefer to have spaces.

Any thoughts?

Alex
 
Old 12-04-2022, 07:30 PM   #2
mrmazda
LQ Guru
 
Registered: Aug 2016
Location: SE USA
Distribution: openSUSE 24/7; Debian, Knoppix, Mageia, Fedora, others
Posts: 5,877
Blog Entries: 1

Rep: Reputation: 2078Reputation: 2078Reputation: 2078Reputation: 2078Reputation: 2078Reputation: 2078Reputation: 2078Reputation: 2078Reputation: 2078Reputation: 2078Reputation: 2078
If you're stuck using HTML email, whitespace is normally collapsed by default. If you replace each space with   then you might achieve the desired effect. Plain text email normally won't collapse whitespace. FMI.
 
Old 12-05-2022, 03:27 PM   #3
MadeInGermany
Senior Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 2,832

Rep: Reputation: 1219Reputation: 1219Reputation: 1219Reputation: 1219Reputation: 1219Reputation: 1219Reputation: 1219Reputation: 1219Reputation: 1219
Hmm, Subject is never HTML.
I think the leading whitespace is dropped by the mailer (sendmail, postfix, exim...).
Ask its FAQ.
A reason might be anti-spam.
 
Old 12-05-2022, 05:15 PM   #4
mrmazda
LQ Guru
 
Registered: Aug 2016
Location: SE USA
Distribution: openSUSE 24/7; Debian, Knoppix, Mageia, Fedora, others
Posts: 5,877
Blog Entries: 1

Rep: Reputation: 2078Reputation: 2078Reputation: 2078Reputation: 2078Reputation: 2078Reputation: 2078Reputation: 2078Reputation: 2078Reputation: 2078Reputation: 2078Reputation: 2078
Quote:
Originally Posted by MadeInGermany View Post
Subject is never HTML.
It shouldn't be, but that wouldn't stop yet another inept mail client, such as webmail. Might it not be because a proportional font was used instead of monospace?
 
Old 12-05-2022, 06:17 PM   #5
rclark
Member
 
Registered: Jul 2008
Location: Montana USA
Distribution: KUbuntu, Fedora (KDE), PI OS
Posts: 496

Rep: Reputation: 182Reputation: 182
Or you could just use one '.' or '_' at beginning and add your spaces. Just a thought.
 
Old 12-05-2022, 06:41 PM   #6
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,249

Rep: Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323
Non-breaking space character? You can copy and paste one from here:

https://www.compart.com/en/unicode/U+00A0
 
Old 12-05-2022, 06:53 PM   #7
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,748

Rep: Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222
Quote:
Originally Posted by mrmazda View Post
If you're stuck using HTML email, whitespace is normally collapsed by default. If you replace each space with   then you might achieve the desired effect. Plain text email normally won't collapse whitespace. FMI.
Quote:
Originally Posted by MadeInGermany View Post
Hmm, Subject is never HTML.
I think the leading whitespace is dropped by the mailer (sendmail, postfix, exim...).
Ask its FAQ.
A reason might be anti-spam.
Quote:
Originally Posted by mrmazda View Post
It shouldn't be, but that wouldn't stop yet another inept mail client, such as webmail. Might it not be because a proportional font was used instead of monospace?
IMO the whitespace is probably being collapsed by the email client/reader.
OP, where is the listing you show quoted coming from? A web page? If not, which email client are you using?
 
Old 12-06-2022, 12:14 AM   #8
Michael Uplawski
Senior Member
 
Registered: Dec 2015
Posts: 1,623
Blog Entries: 40

Rep: Reputation: Disabled
Different thing (me agin).

Does “mail list” mean list of mails or “mailing list”. As you are in Britain, I want to believe it is the first case and that I do not have to explode. Pardon my intervention in this case.
 
Old 12-06-2022, 06:32 AM   #9
aikempshall
Member
 
Registered: Nov 2003
Location: Bristol, Britain
Distribution: Slackware
Posts: 902

Original Poster
Rep: Reputation: 153Reputation: 153
Quote:
Originally Posted by scasey View Post
IMO the whitespace is probably being collapsed by the email client/reader.
OP, where is the listing you show quoted coming from? A web page? If not, which email client are you using?
I'm using client/reader mailx version v14.9.23

After some testing the following pattern has emerged
  1. If the subject text starts with multiple spaces they get stripped out
  2. If the subject text starts with a non-whitespace character and the subject text doesn't exceed length of 60 characters whitespace is preserved
  3. if the subject text starts with a non-whitespace character and the subject text exceeds length of 60 characters one block of whitespace is collapsed even though the length of the subject text exceeds 60 characters - see example below

Code:
 echo "Message here" | mail -s "1234567890          1234567890         1234567890         1234567890        1234567890          abcdefghij          klmnopqrst" -- alex
Code:
 U 36 alex@mylaptop.vict 2022-12-06 12:17   17/633   1234567890          1234567890         1234567890 1234567890        1234567890          abcdefghij          klmnopqrst

how message is stored in filesystem. The block of subject whitespace is as sent not collapsed.


Code:
Return-Path: <alex@mylaptop.victoria.org>
X-Original-To: alex
Delivered-To: alex@mylaptop.victoria.org
Received: by mylaptop.victoria.org (Postfix, from userid 1001)
        id D6ACB224032; Tue,  6 Dec 2022 14:39:54 +0000 (GMT)
Date: Tue, 06 Dec 2022 14:39:54 +0000
To: alex@mylaptop.victoria.org
Subject: 1234567890          1234567890         1234567890        
 1234567890        1234567890          abcdefghij          klmnopqrst
User-Agent: mailx v14.9.23

Last edited by aikempshall; 12-06-2022 at 08:51 AM. Reason: added excert from message box
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
check leading and trailing white space from a variable and fail the script dilip_d21 Linux - Software 20 12-13-2021 09:03 AM
LXer: Add leading zeroes that aren't really leading LXer Syndicated Linux News 0 09-13-2019 12:31 PM
Background of Facebook comment shows white letters on white backgroundt radiogoop Linux - Newbie 2 02-12-2014 04:22 AM
Evolution display problem - white fonts on white background wolecki Linux - Software 1 06-17-2013 04:33 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:27 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration