in reply to Re^3: text formatting
in thread text formatting
Hi,
I was in the process of implementing a custom Email interface using Perl. For this I used, POP::MailClient (for downloading mails from Qmail server), MIME::Parser(for reading the body content).
Initially we had issues when displaying the mail content in the web interface, where special symbols like =A0, =, some HTML tags would be shown in the mail content. This was fixed after introducing MIME::Base64 and MIME::QuotedPrint.
Now, we are trying to figure a way to format the mail message that needs to be displayed in the web interface. As you may be aware, we can use either text/plain or text/html part of actual mail file for displaying the mail message. Here we can use only text/html as it supports formatting like "Bold" "Italics" Colors etc. We were able to strip that part but, at some times, the message doesn't get wrapped after a fixed number of characters, and hence the readers will have to scroll from left to right to read the message. So we tried to word wrap the contents using Text::Format module. But here, it gets word wrapped in random places. We gave the option to word wrap after 70 characters but it is not working as expected. Maybe we interpreted the working of the module in a wrong way. Please go through the script which we are using to display the mail message and also a typical mail file that we are trying to display the message in the web interface.We are interested in displaying the contents that comes under Content Type: text/html in the mail file.
If I had an option to include the screenshot, it would've been better to show the current formatting. But I don't know how I can show the current text formatting without it. But I will give a try. Please go through.
##################CURRENT MAIL INTERFACE OUTPUT########################
Hi Lara,
The Email Issue (matter
getting shattering/ numbers coming in between etc..) was addressed to
Joseph and he is looking into this with highest priority. This
will be fixed ASAP.
Thanks,
Scott Valentine
QC - Manager (Sales)
Xxxxxxxx Software
Solutions, Inc.
XXXXXXXXXXX Medical Transcription Services
XXXX
Martins Rd.
Xxxxxxxx, AZ XXXXX
Phone:
XXX-XXX-XXXX
www.xxxxxxxxxxx.com
###################################EXPECTED MAIL INTERFACE OUTPUT########################################
Hi Lara,
The Email Issue (matter getting shattering/ numbers coming in between
etc..) was addressed to Joseph and he is looking into this with highest
priority. This will be fixed ASAP.
Thanks,
Scott Valentine
DS - Manager (Mktng)
Xxxxxxxx Software Solutions, Inc.
XXXXXXXXXXX Medical Transcription Services
XXXX Martins Rd.
Xxxxxxxx, AZ XXXXX
Phone: XXX-XXX-XXXX
www.xxxxxxxxxxx.com
##################################QMAIL FILE - RAW###############################
Subject: Email Issue
Date: Mon, 8 Feb 2010 00:45:32 -0500
X-Mailer: Perl script "cms.pl"
using Mail::Sender 0.8.16 by Jenda Krynicky, Czechlands
running on xxx.yyyyyyyyyyy.com (127.0.0.1)
under account "apache"
Message-ID: <20100208_054532_075707.ds_mgr1@xxxxx.yyyyyyyyyyy.com>
MIME-Version: 1.0
Content-type: text/html
#!/usr/bin/perl use CGI; use CGI::Carp qw(fatalsToBrowser); use Text::Format; my $q = new CGI; print $q->header(); my $body = "<pre></pre>Hi Lara,<br> The Email Issue +(matter getting shattering/ numbers coming in between etc..) was addr +essed to Joseph and he is looking into this with highest priority. Th +is will be fixed ASAP.<br><br>Thanks,<br> <br/><br/><br/><br/><b +r/><br/> <br/> Scott Valentine<br>DS - Manager (Mktng)<br>Xxxxxxxx Software Solutions +, Inc.<br>XXXXXXXXXXX Medical Transcription Services<br>XXXX Martins +Rd.<br>Xxxxxxxx, AZ XXXXX<br>Phone: XXX-XXX-XXXX<br>www.xxxxxxxxxxx.c +om<br/>"; $body = Text::Format->new({columns => 70,firstIndent => 0})->form +at($body); print $body;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: text formatting
by ikegami (Patriarch) on Feb 17, 2010 at 12:35 UTC |