Solved

Minor modification need of a script

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

It is a general practice to get rid of old user profiles on a computer  in a LAN environment. As I have been working with a company in a LAN environment where users move from one place to some other place at times. This will make many user profil…
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
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…

705 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

18 Experts available now in Live!

Get 1:1 Help Now