modoboa / modoboa-webmail

The webmail of Modoboa
MIT License
73 stars 48 forks source link

Not able to send Mail #265

Open sabo14 opened 6 months ago

sabo14 commented 6 months ago

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

tonioo commented 6 months ago

@sabo14 Can you describe your issue a bit more?

sabo14 commented 6 months ago

send button disabled as shown

sabo14 commented 6 months ago

There was issue in SMTP server Issue Resolved

ntninja commented 6 months ago

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 commented 6 months ago

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 commented 6 months ago

is your postfix service working Properly ??

sabo14 commented 6 months ago

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

claudionirqs commented 6 months ago

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 commented 6 months ago

Did you check using external smtp server

On Mon, 26 Feb 2024, 7:09 pm Claudionir Queiroz, @.***> wrote:

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.

— Reply to this email directly, view it on GitHub https://github.com/modoboa/modoboa-webmail/issues/265#issuecomment-1964234051, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUQSDSQAB5DLVTTWSORZCITYVSJSFAVCNFSM6AAAAABDIKYR62VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNRUGIZTIMBVGE . You are receiving this because you were mentioned.Message ID: @.***>

claudionirqs commented 6 months ago

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 commented 6 months ago

Are you able to receive emails if yes than make a account on smtp2go.com and in admin settings add external smtp address or you can come on anydesk with me

On Mon, 26 Feb 2024, 8:52 pm Claudionir Queiroz, @.***> wrote:

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!

— Reply to this email directly, view it on GitHub https://github.com/modoboa/modoboa-webmail/issues/265#issuecomment-1964474800, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUQSDSW46P4PM56KBJPWVMTYVSVTTAVCNFSM6AAAAABDIKYR62VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNRUGQ3TIOBQGA . You are receiving this because you were mentioned.Message ID: @.***>

claudionirqs commented 6 months ago

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 commented 6 months ago

Modoboa/Modoboa-Webmail also support smtp but by using External SMTP Server

  1. you no Need to Manage your SMTP reputation
  2. You are using free secure smtp for your server
  3. Provide hustle free email deliverabilty

On Tue, 27 Feb 2024, 12:05 am Claudionir Queiroz, @.***> wrote:

Yes, I can do it. But I don't understand why do I need to use other SMTP services if I'm deploying one server to do that. I don't prettend to send massive e-maisl, is not possible just to setup postfiz or modoboa to use other valid port, for exemple 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?

— Reply to this email directly, view it on GitHub https://github.com/modoboa/modoboa-webmail/issues/265#issuecomment-1964956354, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUQSDSVCGDNZ2ALDQQVUMJDYVTMFNAVCNFSM6AAAAABDIKYR62VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNRUHE2TMMZVGQ . You are receiving this because you were mentioned.Message ID: @.***>

claudionirqs commented 6 months ago

I got it with SMTP2GO. Thankyou very much!