Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able to send Mail #265

Open
sabo14 opened this issue Feb 14, 2024 · 14 comments
Open

Not able to send Mail #265

sabo14 opened this issue Feb 14, 2024 · 14 comments

Comments

@sabo14
Copy link

sabo14 commented Feb 14, 2024

I am Not able to Send Emails While using Multiple Domains
Modoboa Email Error

@tonioo
Copy link
Member

tonioo commented Feb 15, 2024

@sabo14 Can you describe your issue a bit more?

@sabo14
Copy link
Author

sabo14 commented Feb 15, 2024

send button disabled as shown

@sabo14
Copy link
Author

sabo14 commented Feb 16, 2024

There was issue in SMTP server
Issue Resolved

@ntninja
Copy link

ntninja commented Feb 19, 2024

The issue indeed happens when the SMTP connection/login fails. From the user perspective the send button is just greyed out with no further feedback. With DEBUG = True I captured the following trace that isn’t very helpful either in understanding that this is a SMTP connection issue:

TypeError at /webmail/

Object of type bytes is not JSON serializable

/nix/store/niz5fi7ig4iqsn78343p194g6xcnrv06-python3-3.11.6-env/lib/python3.11/site-packages/django/core/handlers/exception.py, line 55, in inner

            return inner
        else:
            @wraps(get_response)
            def inner(request):
                try:
                    response = get_response(request)
                                   ^^^^^^^^^^^^^^^^^^^^^
     …
                except Exception as exc:
                    response = response_for_exception(request, exc)
                return response
            return inner

/nix/store/niz5fi7ig4iqsn78343p194g6xcnrv06-python3-3.11.6-env/lib/python3.11/site-packages/django/core/handlers/base.py, line 197, in _get_response

            if response is None:
                wrapped_callback = self.make_view_atomic(callback)
                # If it is an asynchronous view, run it in a subthread.
                if iscoroutinefunction(wrapped_callback):
                    wrapped_callback = async_to_sync(wrapped_callback)
                try:
                    response = wrapped_callback(request, *callback_args, **callback_kwargs)
                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     …
                except Exception as e:
                    response = self.process_exception_by_middleware(e, request)
                    if response is None:
                        raise
            # Complain if the view returned None (a common error).

/nix/store/rac8pxbi1vapwrlqzbrkycbyg521djzw-python3-3.11.6/lib/python3.11/contextlib.py, line 81, in inner

            """
            return self
        def __call__(self, func):
            @wraps(func)
            def inner(*args, **kwds):
                with self._recreate_cm():
                    return func(*args, **kwds)
                               ^^^^^^^^^^^^^^^^^^^
     …
            return inner
    class AsyncContextDecorator(object):
        "A base class or mixin that enables async context managers to work as decorators."

/nix/store/niz5fi7ig4iqsn78343p194g6xcnrv06-python3-3.11.6-env/lib/python3.11/site-packages/django/contrib/auth/decorators.py, line 23, in _wrapper_view

        that takes the user object and returns True if the user passes.
        """
        def decorator(view_func):
            @wraps(view_func)
            def _wrapper_view(request, *args, **kwargs):
                if test_func(request.user):
                    return view_func(request, *args, **kwargs)
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     …
                path = request.build_absolute_uri()
                resolved_login_url = resolve_url(login_url or settings.LOGIN_URL)
                # If the login url is the same scheme and net location then just
                # use the path as the "next" url.
                login_scheme, login_netloc = urlparse(resolved_login_url)[:2]
                current_scheme, current_netloc = urlparse(path)[:2]

/nix/store/niz5fi7ig4iqsn78343p194g6xcnrv06-python3-3.11.6-env/lib/python3.11/site-packages/modoboa/admin/lib.py, line 47, in wrapped_f

        Some applications (the webmail for example) need a mailbox to
        work.
        """
        def decorator(f):
            @wraps(f)
            def wrapped_f(request, *args, **kwargs):
                if hasattr(request.user, "mailbox"):
                    return f(request, *args, **kwargs)
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
     …
                raise PermDeniedException(_("A mailbox is required"))
            return wrapped_f
        return decorator
    def get_identities(user, searchquery=None, idtfilter=None, grpfilter=None):

/nix/store/niz5fi7ig4iqsn78343p194g6xcnrv06-python3-3.11.6-env/lib/python3.11/site-packages/modoboa_webmail/views.py, line 706, in index

                pass
        response.update(callback=action)
        http_status = 200
        if "status" in response:
            del response['status']
            http_status = 400
        return render_to_json_response(response, status=http_status)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     …

/nix/store/niz5fi7ig4iqsn78343p194g6xcnrv06-python3-3.11.6-env/lib/python3.11/site-packages/modoboa/lib/web_utils.py, line 86, in render_to_json_response

    def render_to_json_response(context, **response_kwargs):
        """Simple shortcut to render a JSON response.
        :param dict context: response content
        :return: ``HttpResponse`` object
        """
        data = json.dumps(context)
                   ^^^^^^^^^^^^^^^^^^^
     …
        response_kwargs["content_type"] = "application/json"
        return HttpResponse(data, **response_kwargs)
    def static_url(path):
        """Returns the correct static url for a given file

/nix/store/rac8pxbi1vapwrlqzbrkycbyg521djzw-python3-3.11.6/lib/python3.11/json/__init__.py, line 231, in dumps

        """
        # cached encoder
        if (not skipkeys and ensure_ascii and
            check_circular and allow_nan and
            cls is None and indent is None and separators is None and
            default is None and not sort_keys and not kw):
            return _default_encoder.encode(obj)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     …
        if cls is None:
            cls = JSONEncoder
        return cls(
            skipkeys=skipkeys, ensure_ascii=ensure_ascii,
            check_circular=check_circular, allow_nan=allow_nan, indent=indent,
            separators=separators, default=default, sort_keys=sort_keys,

/nix/store/rac8pxbi1vapwrlqzbrkycbyg521djzw-python3-3.11.6/lib/python3.11/json/encoder.py, line 200, in encode

                if self.ensure_ascii:
                    return encode_basestring_ascii(o)
                else:
                    return encode_basestring(o)
            # This doesn't pass the iterator directly to ''.join() because the
            # exceptions aren't as detailed.  The list call should be roughly
            # equivalent to the PySequence_Fast that ''.join() would do.
            chunks = self.iterencode(o, _one_shot=True)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     …
            if not isinstance(chunks, (list, tuple)):
                chunks = list(chunks)
            return ''.join(chunks)
        def iterencode(self, o, _one_shot=False):
            """Encode the given object and yield each string

/nix/store/rac8pxbi1vapwrlqzbrkycbyg521djzw-python3-3.11.6/lib/python3.11/json/encoder.py, line 258, in iterencode

                    self.key_separator, self.item_separator, self.sort_keys,
                    self.skipkeys, self.allow_nan)
            else:
                _iterencode = _make_iterencode(
                    markers, self.default, _encoder, self.indent, floatstr,
                    self.key_separator, self.item_separator, self.sort_keys,
                    self.skipkeys, _one_shot)
            return _iterencode(o, 0)
                        ^^^^^^^^^^^^^^^^^
     …
    def _make_iterencode(markers, _default, _encoder, _indent, _floatstr,
            _key_separator, _item_separator, _sort_keys, _skipkeys, _one_shot,
            ## HACK: hand-optimized bytecode; turn globals into locals
            ValueError=ValueError,
            dict=dict,

/nix/store/rac8pxbi1vapwrlqzbrkycbyg521djzw-python3-3.11.6/lib/python3.11/json/encoder.py, line 180, in default

                        pass
                    else:
                        return list(iterable)
                    # Let the base class default method raise the TypeError
                    return JSONEncoder.default(self, o)
            """

            raise TypeError(f'Object of type {o.__class__.__name__} '
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     …
                            f'is not JSON serializable')

        def encode(self, o):
            """Return a JSON string representation of a Python data structure.
            >>> from json.encoder import JSONEncoder

Fixing the SMTP does make it work though!

@claudionirqs
Copy link

claudionirqs commented Feb 26, 2024

I faced the same issue, but even openig the 25 port on firewall and created all DNS Zones correctly, I can all (create domains and accounts, receive internal and external e-mails), but cannot send or reply. Same message apears in the webmail when I click the Send button. Is there someone to help me to identify a solution? I my case the console shows the following message: Uncaught SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON at JSON.parse (<anonymous>) at Function.parseJSON (jquery.min.js:3:4322) at Webmail.<anonymous> (webmail.js:1063:26) at Object.i (jquery.min.js:3:6336) at c (jquery.min.js:3:7857) at Object.fireWith [as rejectWith] (jquery.min.js:3:8658) at k (jquery.min.js:5:14040) at XMLHttpRequest.r (jquery.min.js:5:18226)

@sabo14
Copy link
Author

sabo14 commented Feb 26, 2024

is your postfix service working Properly ??

@sabo14
Copy link
Author

sabo14 commented Feb 26, 2024

in my case user not able to send mail due to SMTP Connection Failure

@claudionirqs
Copy link

is your postfix service working Properly ??

Yes. It is. Including the path to the SSL certificates. In my case, the server is running the postfix in an Azure VM and, Analyzing the mail.log file the only message I found says: "/smtp[171167]: connect to hotmail-com.olc.protection.outlook.com[104.47.70.33]:25: Connection timed out". I'm new in this Linux universe, but I'm loving it and any help will be appreciated.

@sabo14
Copy link
Author

sabo14 commented Feb 26, 2024 via email

@claudionirqs
Copy link

No. As a newby Azure user, I don't now how to do it.

Do you have some link or video to guide me how to do it?

Thanks a lot!

@sabo14
Copy link
Author

sabo14 commented Feb 26, 2024 via email

@claudionirqs
Copy link

claudionirqs commented Feb 26, 2024

Yes, I can do it. But I don't understand why do I need to use other SMTP service if I'm deploying one server to do that. I don't prettend to send massive e-maisl, is not possible just to setup postfix or modoboa to use other valid port, for exemple 2525, 465 or 587 instead of using 25? Thanks for trying to help me. You are an awesome person. What is the best time to connect with you on anydesk, discord or any other tool?

@sabo14
Copy link
Author

sabo14 commented Feb 27, 2024 via email

@claudionirqs
Copy link

I got it with SMTP2GO. Thankyou very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants