Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Minor modification need of a script

Posted on 2004-08-09
5
179 Views
Last Modified: 2013-12-25
Hi:

I have one cgi/perl script, by which after send email it show the following message :

Your email has been sent to the person who registered the company profile.

But I need to show the out put message like this :

-------------------------
Thank your for using our service. <-- these text will be bigger than next line
Your email has been sent to the person who registered the company profile.
-------------------------

The above message should shows in center and the text color will be green.

Here is the script:

------------------------

#!/usr/bin/perl

use CGI::Carp qw(fatalsToBrowser);

$| = 1;

require 'secure/common.sub';

$mail_prog = '/usr/sbin/sendmail' ;

print "Content-Type: text/html\n\n";

&parse;

open(FILE, '/home/user/public_html/domain/header.html');
print <FILE>;
close(FILE);

&Create_DB_Connection;

$username = $dbh->quote($IN{'username'});
$SQL = "SELECT * FROM companies WHERE username=$username";
&Do_SQL;
$pointer = $sth->fetchrow_hashref;
%C = %{$pointer};

if ($IN{'content'}) {

open (MAIL, "|$mail_prog -t");
print MAIL "To: $C{'email'}\n";
print MAIL "Reply-to: $C{'email'}\n";
print MAIL "Bcc: ";
print MAIL "From: $IN{'email'}\n";
print MAIL "Subject: Enquiry from domain.com\n";
print MAIL "\n\n";
print MAIL "$IN{'content'}\n" ;
print MAIL "\nFrom \"$IN{'name'}\"" ;
print MAIL "\n\n";
close (MAIL);
print "Your email has been sent to the person who registered the company profile.";

}
else
{
print <<EOF;
<FORM METHOD=POST ACTION="email.cgi">
<INPUT TYPE="hidden" NAME="username" value="$IN{'username'}"><BR>


<TABLE width="80%" align="center">
<TR>
<TD colspan="2" align="center">
<FONT FACE="Arial" SIZE="3" COLOR="#000F99">Please type the message that you would like to send to <B>$C{'company'}</B> here:<BR>
<TEXTAREA NAME="content" ROWS="15" COLS="70"></TEXTAREA><BR>
</TD>

</TR>
<TR><center><TD>Please enter your name: </TD></center>
<center><TD><INPUT TYPE="text" NAME="name"></center><BR></TD>
</TR>
<TR>
<TD>Please enter your email address: </TD>
<TD><INPUT TYPE="text" NAME="email"><BR></TD>
</TR>
<TR>
<TD colspan="2" align="center"><BR>
<INPUT TYPE="submit" value="Send Email">
</TD>

</TR>

</TABLE>



</FORM>
EOF



}

$dbh->disconnect;
open(FILE, '/home/user/public_html/domain/footer.html');
print <FILE>;
close(FILE);

------------------

Thanks in advance.

rsdn

0
Comment
Question by:Sohel Rana
  • 3
5 Comments
 
LVL 16

Expert Comment

by:xDamox
ID: 11758591
Hi I am not 100% sure what you mean but here:

#!/usr/bin/perl

use CGI::Carp qw(fatalsToBrowser);

$| = 1;

require 'secure/common.sub';

$mail_prog = '/usr/sbin/sendmail' ;

print "Content-Type: text/html\n\n";

&parse;

open(FILE, '/home/user/public_html/domain/header.html');
print <FILE>;
close(FILE);

&Create_DB_Connection;

$username = $dbh->quote($IN{'username'});
$SQL = "SELECT * FROM companies WHERE username=$username";
&Do_SQL;
$pointer = $sth->fetchrow_hashref;
%C = %{$pointer};

if ($IN{'content'}) {

open (MAIL, "|$mail_prog -t");
print MAIL "To: $C{'email'}\n";
print MAIL "Reply-to: $C{'email'}\n";
print MAIL "Bcc: ";
print MAIL "From: $IN{'email'}\n";
print MAIL "Subject: Enquiry from domain.com\n";
print MAIL "\n\n";
print MAIL "$IN{'content'}\n" ;
print MAIL "\nFrom \"$IN{'name'}\"" ;
print MAIL "\n\n";
close (MAIL);
print "Thank your for using our service.";

}
else
{
print <<EOF;
<FORM METHOD=POST ACTION="email.cgi">
<INPUT TYPE="hidden" NAME="username" value="$IN{'username'}"><BR>


<TABLE width="80%" align="center">
<TR>
<TD colspan="2" align="center">
<FONT FACE="Arial" SIZE="3" COLOR="#000F99">Please type the message that you would like to send to <B>$C{'company'}</B> here:<BR>
<TEXTAREA NAME="content" ROWS="15" COLS="70"></TEXTAREA><BR>
</TD>

</TR>
<TR><center><TD>Please enter your name: </TD></center>
<center><TD><INPUT TYPE="text" NAME="name"></center><BR></TD>
</TR>
<TR>
<TD>Please enter your email address: </TD>
<TD><INPUT TYPE="text" NAME="email"><BR></TD>
</TR>
<TR>
<TD colspan="2" align="center"><BR>
<INPUT TYPE="submit" value="Send Email">
</TD>

</TR>

</TABLE>



</FORM>
EOF



}

$dbh->disconnect;
open(FILE, '/home/user/public_html/domain/footer.html');
print <FILE>;
close(FILE);
0
 
LVL 16

Author Comment

by:Sohel Rana
ID: 11758669
Hi :

Now the message shows like this:

Thank you for using our service.

But actually I want the message to show like this with green color text:

Thank you for using our service.
Your email has been sent to the person who registered the company profile.

rsdn
0
 
LVL 16

Author Comment

by:Sohel Rana
ID: 11758681
Forget to tell you that the message should show in center, now it shows at the left hand side.

rsdn
0
 
LVL 48

Accepted Solution

by:
Tintin earned 500 total points
ID: 11759275
Change:

print "Thank your for using our service.";

to

print qq[<p align="center"><font color="green">Thank you for using our service.<br>Your email has been sent to the person who registered the company profile.</font></p>\n];
0
 
LVL 16

Author Comment

by:Sohel Rana
ID: 11760083
Thanks for your help.

rsdn
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The following is a collection of cases for strange behaviour when using advanced techniques in DOS batch files. You should have some basic experience in batch "programming", as I'm assuming some knowledge and not further explain the basics. For some…
Making a simple AJAX shopping cart Couple years ago I made my first shopping cart, I used iframe and JavaScript, it was very good at that time, there were no sessions or AJAX, I used cookies on clients machine. Today we have more advanced techno…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

838 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question