Jump to content

Unknown: Invalid mailbox list: <>


froot
 Share

Recommended Posts

I have an issue on the server when sending mails with WireMailSmtp. I get this Notice:

Notice: Unknown: Invalid mailbox list: <> (errflg=3) in Unknown on line 0

No idea what that could mean ? 

I know that Notices are not a big deal BUT since I handle my form with AJAX, I need the response to contain nothing more than what I want it to.
On the server I populate an array $response with what ever I need on the client, json_encode it and then echo out.

So a Notice or a Warning, if not caught, breaks my JSON.parse(response_json); in the frontend.

if ($config->ajax) :
	
	$subject = $input->post->subject;
	$fullname = $input->post->first.' '.$input->post->last;
	$email = $input->post->email;
	$message = $input->post->message;

    try {

        if ($captchaResponse->success == false) {
            throw new WireException('Captcha abgelaufen');
        }

        $mail = wireMail(); // calling an empty wireMail() returns a wireMail object

        $mail->to('hostmaster@mydomain.tld', 'hostmaster');
        $mail->from = 'hostmaster@mydomain.tld';
        $mail->fromName = $fullname;
        $mail->bcc('dev@mydomain.tld');
        $mail->subject($subject);
        $mail->body($message);
        $mail->replyto($email);

        $numSent = $mail->send();

        $response['redirectURL'] = $pages->get('/success/')->url;
        $response_json = json_encode($response);

        echo $response_json;

    } catch (WireException $e) {

        $errormessage = $e->getMessage();
		$response['errors'] = $errormessage;

        $response['redirectURL'] = $pages->get("/error/");
        $response_json = json_encode($response);

        echo $response_json;

    }
endif;

in the client:

    function sendFormData(formData) {

        var XHR = new XMLHttpRequest();
        XHR.onreadystatechange = function () {

            if (XHR.readyState !== 4) return;
            if (XHR.status >= 200 && XHR.status < 300) {

                try {

                    response_obj = JSON.parse(XHR.response);
                    window.location.href = response_obj.redirectURL;


                } catch(err) {

                    response_obj = JSON.parse(XHR.response);
                    window.location.href = response_obj.redirectURL;

                }

            }

        };

        XHR.open('POST', '', true);
        XHR.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
        XHR.send(formData);

    }

Is that a good approach? If not, what's a better solution? Can/should I catch Notices and Warnings somehow? Should I debug this Notice to no happen? Should I not bother and just turn off debug mode?

Link to comment
Share on other sites

I'm positive it's well configured, I use WireMailSmtp and AFAIK there's no confusion with IMAP.
It used to work just fine but then again, never got to see any debug info since I had it setup as a simple HTML form which redirected right after the email was sent which worked and still works just fine.

Link to comment
Share on other sites

figured it out, my bad, it says Invalid mailbox list because the bcc-recipient-field was not populated. I thought it was. Never mind.

I'm still wondering though…

3 hours ago, fruid said:

Is that a good approach? If not, what's a better solution? Can/should I catch Notices and Warnings somehow? Should I debug this Notice to no happen? Should I not bother and just turn off debug mode?

after all it's prone to fail if ever the server spits out any notice, warning or error. 

turning of debug mode does not necessarily prevent notices, does it?

Link to comment
Share on other sites

2 hours ago, fruid said:

turning of debug mode does not necessarily prevent notices, does it?

Actually, it does (at least everything but fatal errors). That's one of the reasons (besides information disclosure) you shouldn't use debug mode on a production site.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...