merrymonk has asked for the wisdom of the Perl Monks concerning the following question:

I am still trying to sort the smpt e-mail question that kindly Monks helped me with last week.
I am also trying to see if the attached form will work.
It is a simple use of MIME where:
1.you add an e-mail address for $From and $To. (using your own e-mail address means you simply send one to yourself).
2. you add the mail server name for $Host.
The situation is that:
1. when I use my own e-mail address with my server name 'mail.btinternet.com' I get the error shown below;
2. when two other people do similar things but use their own server (which is not associated with bt and not Outlook or Outlook Express) all goes well.
Is there a Monk who can explain what I should do to make it work for me?
I have searched for an explanation but have not found one!
Error message
Failed to send message error n <6> message <The handle is invalid.
>
use strict "vars"; my ($en, $en_f); use MIME::Entity; my $From = '<e-mail address>'; my $To = '<e-mail address>'; my $Subject = 'Test'; my $Type = 'text/plain'; my $Host = '<mail server name>'; my $msg = MIME::Entity->build( From => $From, To => $To, Subject => $Subject, Type => $Type, Data => 'This is a test message', ); my @ok = $msg->smtpsend( Host => $Host, To => $To ); if (@ok) { print "Sent message to: ", join(', ', @ok), "\n"; } else { $en = 0; $en = Win32::GetLastError(); $en_f = Win32::FormatMessage($en); print "Failed to send message error n <$en> message <$en_f>\n"; }

Replies are listed 'Best First'.
Re: Puzzling MIME e-mail failure
by Anonymous Monk on Jun 24, 2009 at 13:44 UTC
      Do you think that this is failing because my e-mail 'server'
      requires authenication to be set for outgoing e-mails?
        If the diagnostic messages haven't changed, that is exactly the cause.