prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Add ability to specify SMTP port
  Some relayed domains may live on machines that accept SMTP on a nonstandard port, e.g., port 2525. This would allow users to relay for domains by appending `:port` to the hostname or IP address.
  Add ability to specify SMTP port
  Some relayed domains may live on machines that accept SMTP on a nonstandard port, e.g., port 2525. This would allow users to relay for domains by appending `:port` to the hostname or IP address.
  
  </issue>
  <code>
  [start of core/admin/mailu/internal/views/postfix.py]
  1 from mailu import models
  2 from mailu.internal import internal
  3 
  4 import flask
  5 import re
  6 
  7 
  8 @internal.route("/postfix/domain/<domain_name>")
  9 def postfix_mailbox_domain(domain_name):
  10     if re.match("^\[.*\]$", domain_name):
  11         return flask.abort(404)
  12     domain = models.Domain.query.get(domain_name) or \
  13              models.Alternative.query.get(domain_name) or \
  14              flask.abort(404)
  15     return flask.jsonify(domain.name)
  16 
  17 
  18 @internal.route("/postfix/mailbox/<path:email>")
  19 def postfix_mailbox_map(email):
  20     user = models.User.query.get(email) or flask.abort(404)
  21     return flask.jsonify(user.email)
  22 
  23 
  24 @internal.route("/postfix/alias/<path:alias>")
  25 def postfix_alias_map(alias):
  26     localpart, domain_name = models.Email.resolve_domain(alias)
  27     if localpart is None:
  28         return flask.jsonify(domain_name)
  29     destination = models.Email.resolve_destination(localpart, domain_name)
  30     return flask.jsonify(",".join(destination)) if destination else flask.abort(404)
  31 
  32 
  33 @internal.route("/postfix/transport/<path:email>")
  34 def postfix_transport(email):
  35     if email == '*' or re.match("(^|.*@)\[.*\]$", email):
  36         return flask.abort(404)
  37     localpart, domain_name = models.Email.resolve_domain(email)
  38     relay = models.Relay.query.get(domain_name) or flask.abort(404)
  39     return flask.jsonify("smtp:[{}]".format(relay.smtp))
  40 
  41 
  42 @internal.route("/postfix/sender/login/<path:sender>")
  43 def postfix_sender_login(sender):
  44     localpart, domain_name = models.Email.resolve_domain(sender)
  45     if localpart is None:
  46         return flask.abort(404)
  47     destination = models.Email.resolve_destination(localpart, domain_name, True)
  48     return flask.jsonify(",".join(destination)) if destination else flask.abort(404)
  49 
  50 
  51 @internal.route("/postfix/sender/access/<path:sender>")
  52 def postfix_sender_access(sender):
  53     """ Simply reject any sender that pretends to be from a local domain
  54     """
  55     if not is_void_address(sender):
  56         localpart, domain_name = models.Email.resolve_domain(sender)
  57         return flask.jsonify("REJECT") if models.Domain.query.get(domain_name) else flask.abort(404)
  58     else:
  59         return flask.abort(404)
  60 
  61 
  62 def is_void_address(email):
  63     '''True if the email is void (null) email address.
  64     '''
  65     if email.startswith('<') and email.endswith('>'):
  66         email = email[1:-1]
  67     # Some MTAs use things like '<MAILER-DAEMON>' instead of '<>'; so let's
  68     # consider void any such thing.
  69     return '@' not in email
  70
  [end of core/admin/mailu/internal/views/postfix.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/core/admin/mailu/internal/views/postfix.py b/core/admin/mailu/internal/views/postfix.py
  --- a/core/admin/mailu/internal/views/postfix.py
  +++ b/core/admin/mailu/internal/views/postfix.py
  @@ -36,7 +36,11 @@
           return flask.abort(404)
       localpart, domain_name = models.Email.resolve_domain(email)
       relay = models.Relay.query.get(domain_name) or flask.abort(404)
  -    return flask.jsonify("smtp:[{}]".format(relay.smtp))
  +    ret = "smtp:[{0}]".format(relay.smtp)
  +    if ":" in relay.smtp:
  +        split = relay.smtp.split(':')
  +        ret = "smtp:[{0}]:{1}".format(split[0], split[1])
  +    return flask.jsonify(ret)
   
   
   @internal.route("/postfix/sender/login/<path:sender>")
  
verification_info: {"golden_diff": "diff --git a/core/admin/mailu/internal/views/postfix.py b/core/admin/mailu/internal/views/postfix.py\n--- a/core/admin/mailu/internal/views/postfix.py\n+++ b/core/admin/mailu/internal/views/postfix.py\n@@ -36,7 +36,11 @@\n         return flask.abort(404)\n     localpart, domain_name = models.Email.resolve_domain(email)\n     relay = models.Relay.query.get(domain_name) or flask.abort(404)\n-    return flask.jsonify(\"smtp:[{}]\".format(relay.smtp))\n+    ret = \"smtp:[{0}]\".format(relay.smtp)\n+    if \":\" in relay.smtp:\n+        split = relay.smtp.split(':')\n+        ret = \"smtp:[{0}]:{1}\".format(split[0], split[1])\n+    return flask.jsonify(ret)\n \n \n @internal.route(\"/postfix/sender/login/<path:sender>\")\n", "issue": "Add ability to specify SMTP port\nSome relayed domains may live on machines that accept SMTP on a nonstandard port, e.g., port 2525. This would allow users to relay for domains by appending `:port` to the hostname or IP address.\nAdd ability to specify SMTP port\nSome relayed domains may live on machines that accept SMTP on a nonstandard port, e.g., port 2525. This would allow users to relay for domains by appending `:port` to the hostname or IP address.\n", "before_files": [{"content": "from mailu import models\nfrom mailu.internal import internal\n\nimport flask\nimport re\n\n\n@internal.route(\"/postfix/domain/<domain_name>\")\ndef postfix_mailbox_domain(domain_name):\n    if re.match(\"^\\[.*\\]$\", domain_name):\n        return flask.abort(404)\n    domain = models.Domain.query.get(domain_name) or \\\n             models.Alternative.query.get(domain_name) or \\\n             flask.abort(404)\n    return flask.jsonify(domain.name)\n\n\n@internal.route(\"/postfix/mailbox/<path:email>\")\ndef postfix_mailbox_map(email):\n    user = models.User.query.get(email) or flask.abort(404)\n    return flask.jsonify(user.email)\n\n\n@internal.route(\"/postfix/alias/<path:alias>\")\ndef postfix_alias_map(alias):\n    localpart, domain_name = models.Email.resolve_domain(alias)\n    if localpart is None:\n        return flask.jsonify(domain_name)\n    destination = models.Email.resolve_destination(localpart, domain_name)\n    return flask.jsonify(\",\".join(destination)) if destination else flask.abort(404)\n\n\n@internal.route(\"/postfix/transport/<path:email>\")\ndef postfix_transport(email):\n    if email == '*' or re.match(\"(^|.*@)\\[.*\\]$\", email):\n        return flask.abort(404)\n    localpart, domain_name = models.Email.resolve_domain(email)\n    relay = models.Relay.query.get(domain_name) or flask.abort(404)\n    return flask.jsonify(\"smtp:[{}]\".format(relay.smtp))\n\n\n@internal.route(\"/postfix/sender/login/<path:sender>\")\ndef postfix_sender_login(sender):\n    localpart, domain_name = models.Email.resolve_domain(sender)\n    if localpart is None:\n        return flask.abort(404)\n    destination = models.Email.resolve_destination(localpart, domain_name, True)\n    return flask.jsonify(\",\".join(destination)) if destination else flask.abort(404)\n\n\n@internal.route(\"/postfix/sender/access/<path:sender>\")\ndef postfix_sender_access(sender):\n    \"\"\" Simply reject any sender that pretends to be from a local domain\n    \"\"\"\n    if not is_void_address(sender):\n        localpart, domain_name = models.Email.resolve_domain(sender)\n        return flask.jsonify(\"REJECT\") if models.Domain.query.get(domain_name) else flask.abort(404)\n    else:\n        return flask.abort(404)\n\n\ndef is_void_address(email):\n    '''True if the email is void (null) email address.\n    '''\n    if email.startswith('<') and email.endswith('>'):\n        email = email[1:-1]\n    # Some MTAs use things like '<MAILER-DAEMON>' instead of '<>'; so let's\n    # consider void any such thing.\n    return '@' not in email\n", "path": "core/admin/mailu/internal/views/postfix.py"}]}