[imp] how to show smtp error messages

Michael Redinger Michael.Redinger@uibk.ac.at
Tue, 1 Jan 2002 16:12:42 +0100 (CET)


---------------------- multipart/mixed attachment
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


On Fri, 28 Dec 2001, I wrote:


> I'd like to make IMP show the error messages the SMTP server returns (eg.
> "User unknown" or smth. like "virus found") because I think that generic
> "There was an error sending your message" is somewhat insufficient ...
> I'm trying to figure out where to add this. I've to confess that I'm completely
> lost. I'd appreciate a tip where this should be added. compose.php? Somewhere
> else in IMP or HORDE? PEAR?



After reading lots of PEAR code I found that the answer is obvious: :)
$status->getMessage()
is already used in compose.php to log error messages. I just added an option
to display this error in the compose window.

As always :) - patch attached. New config option:
$conf['compose']['showsmtperror'] = true;


I also tried to make the errors be shown using JavaScript.
However, I terribly failed - the alert box simply isn't displayed. I tried
removing the php if's, only make an alert('hello') bad I just can't make it
work ... :(
See the code below.


Michael

####
     if ($browser->hasFeature('javascript')): ?>
     <script language="JavaScript" type="text/javascript">
     <!--
     alert('<?= _("There was an error sending your message") . ($conf['compose']['showsmtperror'] ? ":\n<br>\n" . $status->getMessage() : '')?>');
     return false;
     // -->
     </script>

     <?php
     endif;
     Horde::raiseMessage(_("There was an error sending your message") . ($conf['compose']['showsmtperror'] ? "\n<br>\n" . $status->getMessage() : ''), HORDE_ERROR);
#####



-----BEGIN PGP SIGNATURE-----
Version: PGP 6.5.8

iQA/AwUBPDHR8Q/XqdllwsEdEQLstACg3iGeasM26dTUwTtG82mDZAxmoyIAn1fH
ALugYV5fRLu3kk7IH6wes41s
=I3D6
-----END PGP SIGNATURE-----


---------------------- multipart/mixed attachment
LS0tIGNvbXBvc2UucGhwLm9yaWcJVHVlIEphbiAgMSAxNjowMToyOCAyMDAy
DQorKysgY29tcG9zZS5waHAJVHVlIEphbiAgMSAxNjowMTo0MSAyMDAyDQpA
QCAtNzg5LDcgKzc4OSw3IEBADQogICAgICB9DQogICAgICB1bnNldCgkbXNn
KTsNCiAgICAgICRnZXRfc2lnID0gZmFsc2U7DQotICAgICBIb3JkZTo6cmFp
c2VNZXNzYWdlKF8oIlRoZXJlIHdhcyBhbiBlcnJvciBzZW5kaW5nIHlvdXIg
bWVzc2FnZSIpLCBIT1JERV9FUlJPUik7DQorICAgICBIb3JkZTo6cmFpc2VN
ZXNzYWdlKF8oIlRoZXJlIHdhcyBhbiBlcnJvciBzZW5kaW5nIHlvdXIgbWVz
c2FnZSIpIC4gKCRjb25mWydjb21wb3NlJ11bJ3Nob3dzbXRwZXJyb3InXSA/
ICJcbjxicj5cbiIgLiAkc3RhdHVzLT5nZXRNZXNzYWdlKCkgOiAnJyksIEhP
UkRFX0VSUk9SKTsNCiAgICAgIGJyZWFrOw0KIA0KICBjYXNlIFNBVkVfRFJB
RlQ6DQo=
---------------------- multipart/mixed attachment--