Gossamer Forum
Home : Products : DBMan : Customization :

Email problems

Quote Reply
Email problems
Unsure Hi Again,

I have been playing with the Email function and have it working except for one minor problem, when the email arrives all the information is on the same line.

EG. User=admin..Record_ID=1979

What I want to see is each field on a different line, I have tried \n after each field to no avail..

User=admin..

Record_ID=1979..



All the rest is ok, I have attached a copy of the line which sends a email when ever a new record is added successfully.

system("echo User=$rec{'userid'}..Record_ID=$rec{'Count'} | c:\\mksnt\\smtpmail -f home -s New.Record.Added.to.database colin.a.wilcox\@home.com") ;


Anyone have any idea that could help me here.....

Thanks..


Quote Reply
Re: [cwilcox] Email problems In reply to
Where did you try putting the \n? Did you try something like:-

system("echo User=$rec{'userid'}."\n".Record_ID=$rec{'Count'}."\n" | c:\\mksnt\\smtpmail -f home -s New.Record.Added.to.database colin.a.wilcox\@home.com") ;

Btw, it would be easier to use forward slashes in your paths - even on Windoze systems:-

system("echo User=$rec{'userid'}..Record_ID=$rec{'Count'} | c:/mksnt/smtpmail -f home -s New.Record.Added.to.database colin.a.wilcox\@home.com") ;

It's easier to spot the escape characters that way.
Quote Reply
Re: [cwilcox] Email problems In reply to
Unsure Hi and thanks for the quick reply, I tried what you suggested and still no good.

1. Changed the \\ to / no go..

2. Put "\n" in where you suggested still no good.

I'm lost any more suggestions..
Quote Reply
Re: [wysardry] Email problems In reply to
This is the code in my script:

#####################################
# Send email to the user #
#####################################
$file = "$in{'Userid'}-$in{'ID'}.htm"; # File to send to user
$recipient = "$in{'submit_by'}";

open (MAIL, "$mailprog") || &cgierr("Can't start mail program");
print MAIL "To: $recipient\n";
print MAIL "From: $admin_email\n";
print MAIL "Subject: $html_title $rec{'coname1'}\n\n";
print MAIL "You completed an Application as follows: \n\n";
foreach $col ($db_cols) {
print MAIL "Company Name 1: $rec{'coname1'}\n";
print MAIL "To be registered in: $rec{'Jurisdiction'}\n";
print MAIL "First Beneficiary: $rec{'benename1'}\n";
print MAIL "Country: $rec{'Country1'}\n";
print MAIL "email address: $rec{'submit_by'}\n";
print MAIL "On: $rec{'Date'}\n\n";
print MAIL "Go to 'http://www.domain.com/files/$file' to view and save the complete Application.\n\n";
print MAIL "Regards\n";
}

close (MAIL);

###########

This works. \n gives a single line break, and \n\n gives a double line break!
-------------
David Olley
Anglo & Foreign International Limited,
http://www.firehelmets.co.uk

There are 10 types of people in the world: those who understand binary, and those who don't.
Quote Reply
Re: [davidolley] Email problems In reply to
That example works because you are using open and print which handles the newlines properly, however your other example is running a system command.

You could solve this problem I think by piping the email to your smtpmail binary, eg....

open MAIL, "| /path/to/smtpmail" or die $!;
print ...
close MAIL;