Solved

Minor modification need of a script

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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
php survey script 4 65
disabled AD accounts info 3 69
Python Encoding Problem \u2013 4 108
get remote physical servers and platforms 5 51
Introduction This tutorial will give you a fast look what you can do with WhizBase. I expect you already know how to work with HTML at least, and that you understand the basics of the internet and how the internet works. WhizBase is a server-s…
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…
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…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

863 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now