Mail error with MacPerl

[email protected] (Mark Wheeler) Thu, 03 Oct 2002 14:07:33 -0700
Newsgroups perl.macperl.modules
Message-ID <B9C1FFA5.16B8%[email protected]>
Hi all,

I'm not sure if this is a SIMS (my mail server) situation or a MacPerl
situation, but I'll check both. Everything was working fine this morning,
but this afternoon, I get the following error when trying to send mail
through MacPerl using my mail script. After sending the mail, I get the
following error:

Diagnostic Output

# SMTP RCPT command failed:
# 5.7.1 you are not allowed to use this address: [email protected]
#

(find the script below)

Any ideas? I haven't changed a thing it just stopped sending successfully. I
sent mail the regular way with Outlook Express and all my accounts seem to
send and receive OK, so I'm leaning toward it being a MacPerl or possibly a
corrupt script? Can that happen with MacPerl scripts?

I am using MIME::Lite to send the mail. I am using the latest version of all
the above mentioned software.

Any help is greatly appreciated. Thank you.

Mark Wheeler


SCRIPT ---------------------------------------------------------

#!/usr/local/bin/perl

#================================
# Parse the input from the form =
#================================

read(STDIN,$temp,$ENV{'CONTENT_LENGTH'});
@pairs=split(/&/,$temp);
foreach $item(@pairs)
 {
  ($key,$content)=split(/=/,$item);
  $content=~tr/+/ /;
  $content=~s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;
  $fields{$key}=$content;
 }    

#=================================
# Gets rid of the extra carriage =
# returns added in the TextArea  =
# when the form is submitted.    =
#=================================

$fields{message}=~s/\n+//g;


#==============================================================
# Print to screen the data gathered for testing purposed only =
#==============================================================

# print "Content-type: text/html\n\n";
# print "<HTML>\n";
# print "<BODY BGCOLOR=#FFFFFF>\n";
# print "<CENTER>\n";
# print "THANK YOU<BR>\n";
# print "</CENTER>\n";
# print "<BR>\n";
# print "<BR>\n";
# print "Server: $fields{server}<BR>\n";
# print "To email: $fields{to}<BR>\n";
# print "From email: $fields{from}<BR>\n";
# print "Subject: $fields{subject}<BR>\n";
# print "Message: $fields{message}<BR>\n";
# print "<BR>\n";
# print "<BR>\n";
# print "<CENTER>\n";
# print "Auto-Reply Information<BR>\n";
# print "</CENTER>\n";
# print "<BR>\n";
# print "To email: $fields{from}<BR>\n";
# print "From email: $fields{to}<BR>\n";
# print "Subject: $fields{subject_ar}<BR>\n";
# print "Message: $fields{message_ar}<BR>\n";
# print "</BODY></HTML>";
# print "<BR>\n";
# print "<BR>\n";

#==========================
# Prepare to send message =
#==========================

use MIME::Lite;

# Set up variables

my $server = 'mail.pacbell.net';     # Set this variable to your SMTP server
name
my $from = $fields{from};            # From email address
my $to = '[email protected]'; # To email address
my $subject = $fields{subject};      # The Subject line in the email
my $mime_type = $fields{mime};       # Text or HTML
my $header = "--------------------------------------------------\nName:
$fields{first_name} $fields{last_name}\n\nEmail:
$fields{from}\n--------------------------------------------------\n\n";
my $message = "$header$fields{message}";      # body of the send message

my $mime_msg = MIME::Lite->new(
From => $from,
To   => $to,
Subject => $subject,
Type => $mime_type,
Data => $message
)
or die "Couldn't create MIME body: $!\n"; # If you can't create the email,
don't proceed with the rest of the script

# Initiate the mail transaction

MIME::Lite->send('smtp', $server);
$mime_msg->send() or die "Error sending message: $!\n";

#======================
# Send the Auto-Reply =
#======================

# Set up variables

my $from = '[email protected]';   # From email address
my $to = $fields{from};                  # To email address (reversed 'From'
emailaddress)
my $subject = 'Thank You - TDS';         # The Subject line in the email
my $mime_type = $fields{mime_ar};        # Text or HTML

# Body od the auto-reply message

my $message = '
 <html>
    <head>
        <title></title>
        <style media="screen" type="text/css"><!--
body { color: red; font-size: 12px; font-family: Arial, Helvetica, Geneva,
Swiss, SunSans-Regular; background-color: white }
--></style>
    </head>
    <body bgcolor="#ffffff">
        <table border="0" cellpadding="0" cellspacing="0" width="553"
height="200">
            <tr height="83">
                <td
background="http://www.tonedeafstudios.com/graphics/top_thin.gif"
width="99%" height="83">
                </td>
            </tr>
            <tr>
                <td valign="top" width="99%"><br>
                    <br>
                    Thank for your interest in ToneDeaf Studios. We will get
back to you as soon as possible.
                    <p>TDS</p>
                </td>
            </tr>
        </table>
    </body>
</html>'; # body message for auto-reply

my $mime_msg = MIME::Lite->new(
From => $from,
To   => $to,
Subject => $subject,
Type => $mime_type,
Data => $message
)
or die "Couldn't create MIME body: $!\n"; # If you can't create the email,
don't proceed with the rest of the script

# Initiate the mail transaction

MIME::Lite->send('smtp', $server);
$mime_msg->send() or die "Error sending message: $!\n";

#==============================
# Send user to thank you page =
#==============================

print "Location: $fields{thank_you}\n\n";