Gossamer Forum
Home : General : Perl Programming :

email layout (tab)

Quote Reply
email layout (tab)
Hi,

I would like to layout my email like:
Code:
Lastname, Firstname Foo, Chris
City Amsterdam
Country Netherlands

The forum doen't display my record details in a nice line as well, but I tried to make 2 nice columns)

Just WITH the use of tabs. Because otherwise the information isn't easy to read. But I can't find a way to do this; even tried external (non GT) mailers. I always something like:

Lastname, Firstname Foo, Chris
City Amsterdam
Country Netherlands

Isn't theire any way to do this? Or is this just not possible with sendmail?! I haven't got a clue.....

Last edited by:

ian85: Jun 6, 2007, 11:45 AM
Quote Reply
Re: email layout (tab) In reply to
Post removed..I missed the point.
Quote Reply
Re: email layout (tab) In reply to
Use:

Code:

print MAIL "LastName Firstname\t\t\t: $in{'FirstName'} $in{'LastName'}";


the \t is the character for tab spaces.

Regards,

Eliot Lee
Quote Reply
Re: email layout (tab) In reply to
I'm already using /t and when I checked my logs the information was devided in 2 columns. Only the receivers (my editors) all use Outlook Express. And they don't see the tabs. Could I solve this by sending html-mail? Because I tested this with GM2.0 but I got the same (bad) results. Or do I need to use another char. for the tab with mail-mail? Or is there another option?





Quote Reply
Re: email layout (tab) In reply to
In Reply To:
Could I solve this by sending html-mail?
For GUI-based mail programs...the only format that I know of that will solve your problem is sending it as HTML....which has been discussed in this forum before....

Regards,

Eliot Lee
Quote Reply
Re: email layout (tab) In reply to
Wauw; where I used to have the following routine in my script....

Code:
require "$db_lib_path/Mailer.pm";
my $mailer = new Mailer ( { smtp => $db_smtp_server,
sendmail => $db_mail_path,
from => $from,
subject => $subject,
to => $to,
msg => $msg,
log => $db_mailer_log
} ) or return;
$mailer->send or return;

...I now have:

Code:
my $headers = qq|MIME-Version: 1.0
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit|;

Code:
require "$db_lib_path/Mailer.pm";
my $mailer = new Mailer ( { smtp => $db_smtp_server,
sendmail => $db_mail_path,
headers = > $headers,
from => $from,
subject => $subject,
to => $to,
msg => $msg,
log => $db_mailer_log
} ) or return;
$mailer->send or return;

And I just added <pre> to the beginning of my $msg and </pre> to the end just like:

my $msg = qq|<pre>

....no html tags here needed; Wauw!

</pre>|;


ADDED 1:

I just found out a 'feature'. Because we are only using 2 html tags (<pre> and </pre>) the email is alsow viewable for non-html mailprogramms. Nice isn't it?


ADDED 2:

Only by using <pre> my mailprogramma doesn't display the email in the standard font. I couldn't find anything about this problem online; does anyone know something about this? So to avoid this <pre> problem I needed to use tables. The following works in my mailprogramm, but will it works in others? How can I test this?

Code:
<table border=0>
<tr><td colspan=2><u>title text of this sub (underlined)</u></td></tr>
<tr><td>Lastname, firstname </td><td>[Foo], Chris</td></tr>
<tr><td>Shorttext</td><td>Does this layout work? I'm wondering.</td></tr>
<tr><td>Download file location</td><td><a href="http://www.download.com">download it!</a></td></tr>
</table>

Last edited by:

ian85: Jun 6, 2007, 11:49 AM
Quote Reply
Re: email layout (tab) In reply to
HTML codes will show up with no formatting in non-GUI email programs, like PINE mail. Also, older versions of AOL (3.0 and 4.0) do not support HTML formatted email messages. So, be aware that formatting will not be universal across different email programs.

Regards,

Eliot Lee
Quote Reply
Re: email layout (tab) In reply to
Sorry, I meant the following:

I could not find a good resource on what type of html you could use. So I'm wondering If I can use tables, stylesheets, divs and so on. Or only basic html?

Because I know that the receivers have Outlook, I don't need to worry about non-html-mail programms.

Quote Reply
Re: email layout (tab) In reply to
Just throw in a PRE tag.

<PRE>
Info Info
Info Info
</PRE>

And it should format correctly in fixed character spacing.

Rgds
Wil Stephens

Quote Reply
Re: email layout (tab) In reply to
Wil; two post above you can read why I didn't choose for that option.

Quote Reply
Re: email layout (tab) In reply to
You can use stylesheets and other codes, even javascript in HTML formatted email.

You must be running an intranet application to be so confident that all your users use Outlook...if it is a public web site, that is a pretty big assumption you are making that ALL users are using Outlook, and even if it is an intranet app you are developing, I betcha that some of your users are using shell based mail programs or Netscape Communicator....

Wink

Regards,

Eliot Lee
Quote Reply
Re: email layout (tab) In reply to
You right about the intranet. But not about the "shell based and Netscape" story. At least in my case.

BUT about the content of this threads: Thanks. I didn't know I could use all html tags and features; cool!

One more thing. Are these the correct headers? Because I saw some information on websites that only talked about my second line. What's the 'html mail' story?

my $headers = qq|MIME-Version: 1.0Content-Type: text/html; charset=us-asciiContent-Transfer-Encoding: 7bit|;