Solved

Minor modification need of a script

Posted on 2004-08-09
5
182 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

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

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

In this tutorial I will show you how to provide a dynamic RTF document on your website generated with data from your database. For this tutorial you will need Microsoft Word or WordPad, WhizBase and Microsoft Access. In this tutorial I will show …
This article will show, step by step, how to integrate R code into a R Sweave document
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

680 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