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

max message size server config option #306

Closed
mforde84 opened this issue Feb 3, 2022 · 4 comments
Closed

max message size server config option #306

mforde84 opened this issue Feb 3, 2022 · 4 comments

Comments

@mforde84
Copy link

mforde84 commented Feb 3, 2022

Hi guys,

We are running into a 10mb size limit on relay to gen_smtp. We'd like to test potentially any size of message up to say 20 or 50mb. I noticed there was an issue around this before:

#184

I've very greenfield with erlang, I'm curious if or how we can specify this configuration option within our gen_smtp server session block? Sorry I know it's probably a basic question, I figured someone might be able to point me in the right direction.

Martin

@mforde84
Copy link
Author

mforde84 commented Feb 3, 2022

I made a post in gotthardp/rabbitmq-email#47 as well.

If I understand correctly the DEFAULT_MAXSIZE option is not over-rideable namely because its not specified as an option()

https://github.com/gen-smtp/gen_smtp/blob/master/src/gen_smtp_server_session.erl#L93

If I were to MR this would that be something you'd willing to discuss or commit to build?

@lukebakken
Copy link

Note: this issue can be closed. It will be resolved by this PR - gotthardp/rabbitmq-email#54

@arjan
Copy link
Collaborator

arjan commented Oct 17, 2022

note that handle_HELO and handle_EHLO can return a list of SMTP server options. This way it is possible to override the maxsize. Although admittedly it is not very straightforward.

Elixir example from real code base:

  @maxsize 1000 * 1024 * 1024

  @impl true
  def handle_HELO(hostname, state) do
    {:ok, @maxsize, %State{state | helo: hostname}}
  end

  @impl true
  def handle_EHLO(hostname, extensions, state) do
    extensions = [{'SIZE', '#{@maxsize}'} | :lists.keydelete('SIZE', 1, extensions)]
    {:ok, extensions, %State{state | helo: hostname}}
  end

@arjan arjan closed this as completed Oct 17, 2022
@lukebakken
Copy link

@arjan thanks for pointing out handle_EHLO/3

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

3 participants