Solved

Minor modification need of a script

Posted on 2004-08-09
5
187 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
[X]
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
  • 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In this tutorial I will focus on how to use WhizBase as a tool for sending ICQ messages to ICQ. Here I will use a new technology in WhizBase, published in WhizBase 5.1 version. In this tutorial I will use 3 files, pager.wbsp for the processing, e…
In this tutorial I will show you how to make a simple HTML bar chart with the usage of WhizBase, If you want more information about WhizBase please read my previous articles at http://www.experts-exchange.com/ARTH_5123186.html (http://www.experts-ex…
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…

710 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