Send email from a pipeline container, connect to host MTA by using host network

I need/want to send an email to the committer email once a release pipeline finishes.

I can use sendmail on the runner host as it has got a MTA configured. So, the idea was for the pipeline to start a container that includes sendmail. BUT for that to work the container has to be started using the host network i.e. with --net=host.

It does not seem possible to do that from within .gitlab-ci.yaml?


  # how to declare --net=host?
  image: docker #something
  stage: .post
  allow_failure: true
    - author_email=$(git log --pretty=format:"%ae" -1)
    - sendmail -v $(author_email)  < email.txt

Is my only option here to use a custom Docker image that contains ssntp and a configuration for a remote mailhub?

P.S. this is somewhat related to