Hi
I need help with my postwwwacct script - to send automatic welcome email to my clients
and it is not working Wright.
and I also would like to change it some how so it send one type of email to my resellers and one to
my other clients
hope you can see my needs?
THIS IS THE SCRIPT in scripts/
THIS IS THE EMAIL SENT TO ROOT
I need help with my postwwwacct script - to send automatic welcome email to my clients
and it is not working Wright.
and I also would like to change it some how so it send one type of email to my resellers and one to
my other clients
hope you can see my needs?
THIS IS THE SCRIPT in scripts/
Code:
================================================START OF MY postwwwacct ==========================
#!/usr/local/bin/perl
# You may need to change this path to /usr/local/bin/perl
$mailprog = "/usr/sbin/sendmail";
#**************************************************************
#
#
# To use this script, just set a few variables below, modify the email message to
# your desire, and upload this file to the /scripts directory on your server, renamed
# to postwwwacct and made executable.
#
# Every time an account is created in WHM, this script is automatically called to
# do it's job. Variables are passed to it from WHM's wwwacct script and some of
# those variable are used to customize the email message.
#
# Here are the variables that are passed to this script:
# $ARGV[0] = domain
# $ARGV[1] = username
# $ARGV[2] = password
# $ARGV[3] = space (MB)
# $ARGV[4] = theme
# $ARGV[5] = ded IP (y/n)
# $ARGV[6] = cgi (y/n)
# $ARGV[7] = FP (y/n)
# $ARGV[8] = max ftp (n or #)
# $ARGV[9] = max sql (n or #)
# $ARGV[10] = max POP (n or #)
# $ARGV[11] = max lists (n or #)
# $ARGV[12] = max subs (n or #)
# $ARGV[13] = bandwidth (# or 0) in MB's
# $ARGV[14] = shell (y/n)
# $ARGV[15] = owner
# $ARGV[16] = plan
# $ARGV[17] = max park (# or unlimited)
# $ARGV[18] = max addon (# or unlimited)
# $ARGV[19] = feature list (default)
# $ARGV[20] = contact email
#
#
#
#**************************************************************
# To send yourself a copy of the email, put your email address here.
# If you use spamassassin, you should include a name, like this:
# $email = 'me <[email protected]>';
$email = '[email protected]';
# This is the email address that will be the sender of the automatic email.
# You may prefer to put your own email address here. ;-)
$from = 'Sales <[email protected]>';
# If you prefer to send the email in html format, change the next line to Y.
$usehtml = "Y";
# Change this subject line to whatever you prefer
$subject = "West One Hosting :: Welcome Email";
# This is just to convert the bandwidth from MB to GB for the email message.
# Calculations like this must be done before the message string variables are specified.
$gb = $ARGV[13]/1024;
$gb = $gb . "GB";
# This is the message that will be sent if you choose to use html. You can modify
# this message any way you like. All the $ARGV[#] variables are replaced with the
# appropriate value. See the variables uses above. Do not touch the first or last
# line here. If you use any of the following characters, @ $ or ", you will need to
# escape them by putting a \ in front of them, like: \@ \$ or \"
$html_message = "
<b>Here are the details of your new account:</b><br>\n
<b>Domain Name:</b> $ARGV[0]<br>\n
<b>Username:</b> $ARGV[1]<br>\n
<b>Password:</b> $ARGV[2]<br>\n
<b>Package:</b> $ARGV[16]<br>\n
- space: $ARGV[3]MB<br>\n
- bandwidth: $ARGV[13]MB ($gb)<br>\n
- theme: $ARGV[4]<br>\n
- Dedicated IP ($ARGV[5])<br>\n
- POP accounts: max - $ARGV[10]<br>\n
- mailing lists: max - $ARGV[11]<br>\n
- MySql databases: max - $ARGV[9]<br>\n
- subdomains: max - $ARGV[12]<br>\n
<br>\n
<b>Shell Access:</b> $ARGV[14]<br>\n
<br>\n
++++++++++++++++++++THIS IS THE START OF WHAT I NEED TO ADD++++++++++++++++++++++++++++++++++++
<br>\n
<b>Nameserver & IP 1:</b> $ARGV[?]<br>\n
<b>Nameserver & IP 2:</b> $ARGV[?]<br>\n
<b>Nameserver & IP 3:</b> $ARGV[?]<br>\n
<b>Nameserver & IP 4:</b> $ARGV[?]<br>\n
<br>\n
++++++++++++++++++++THIS IS THE END OF WHAT I NEED TO ADD+++++++++++++++++++++++++++++++++++++++
<b>Contact Email:</b> $ARGV[20]<br>\n
Please keep this up to date.<br>\n
<br>\n
<br>\n
";
# This is the message that will be sent if you choose to use plain text. You can
# modify this message any way you like. All the $ARGV[#] variables are replaced
# with the appropriate value. See the variables uses above. Do not touch the first
# or last line here. If you use any of the following characters, @ $ or ", you will
# need to escape them by putting a \ in front of them, like: \@ \$ or \"
$text_message = "
Here are the details of your new account:
Domain Name: $ARGV[0]
Username: $ARGV[1]
Password: text mail
Package: $ARGV[16]
- space: $ARGV[3]MB
- bandwidth: $ARGV[13]MB ($gb)
- theme: $ARGV[4]
- Dedicated IP ($ARGV[5])
- POP accounts: max - $ARGV[10]
- mailing lists: max - $ARGV[11]
- MySql databases: max - $ARGV[9]
- subdomains: max - $ARGV[12]
Shell Access: $ARGV[14]
Contact Email: $ARGV[20]
Please keep this up to date.
";
#-------------------------------------------------------------------
#-------------------------------------------------------------------
# UNLESS YOU KNOW CGI, DO NOT EDIT ANYTHING BELOW HERE
# Feel free to study the code, but alterations are at your own risk
#-------------------------------------------------------------------
#-------------------------------------------------------------------
if ($ARGV[20] eq "") {
$client_email = $ARGV[1] . "\@" . $ARGV[0];
$emailnote = "$client_email which is username\@domain.com because no email was provided in WHM";
}
else {
$client_email = $ARGV[20];
$emailnote = "$ARGV[20] which was provided in WHM";
}
print "\nSending email to client...\n";
if ($usehtml eq "Y") {
&send_mail_html;
}
else {
&send_mail_txt;
}
print "\nEmail has been sent to client at $emailnote.\n";
if ($email ne "") {
print "A copy was also sent to $email.\n";
}
if (-e "/scripts/postwwwacct2") {
print "\nSending variables to postwwwacct2.\n";
system("/scripts/postwwwacct2",@ARGV);
}
exit;
sub send_mail_html {
print "\nsending mail...\n";
# Open The Mail Program
open(MAIL,"|$mailprog -t");
print MAIL "Content-Type: text/html; charset=iso-8859-1\n";
print MAIL "To: $client_email\n";
if ($email ne "") {
print MAIL "Bcc: $email\n";
}
print MAIL "From: $from\n";
print MAIL "Subject: $subject\n";
print MAIL "<html>\n";
print MAIL "$html_message\n";
print MAIL "</html>\n\n";
close (MAIL);
}
sub send_mail_txt {
print "\nsending mail...\n";
# Open The Mail Program
open(MAIL,"|$mailprog -t");
print MAIL "To: $client_email\n";
if ($email ne "") {
print MAIL "Bcc: $email\n";
}
print MAIL "From: $from\n";
print MAIL "Subject: $subject\n";
print MAIL "$text_message\n";
close (MAIL);
}
================================================END OF MY postwwwacct ==========================
Code:
================================================START OF MY postwwwacct OUTPUT HTML ============
(THIS IS THE COPY SENT TO ROOT)
West One Hosting :: Welcome Email
Here are the details of your new account:
Domain Name: plan
Username: Standard Plan
Password: maxpark
Package: pass
- space: unlimitedMB
- bandwidth: 8MB (0.0078125GB)
- theme: lang
- Dedicated IP (english)
- POP accounts: max - hasshell
- mailing lists: max - n
- MySql databases: max - 32
- subdomains: max - maxaddon
Shell Access: cpmod
Contact Email: domain
Please keep this up to date.
================================================END OF MY postwwwacct OUTPUT HTML ==============