mail/msmtp to MS Exchange help needed

Hello all,

I've used mail/msmtp to easily send mails from my FreeBSD/OpenBSD boxes. There's a new service that requires frequent sending of such emails, and I can easily set this mailers with, for instance gmail accounts.

However, since this service will go live soon, I'd prefer to use our organization's MS Exchange. Unfortunately, I've been unable to set this up successfully, partly because I'm not too familiar with how MS Exchange operates, partly because I couldn't find any good help online on this topic.

I'd appreciate any help on this.

This is my default configuration file:

Code:
    # ------------------------------------------------------------------------------
    # Accounts
    # ------------------------------------------------------------------------------

    # Main Account
    defaults
    tls on
    tls_starttls on
    tls_trust_file /etc/ssl/certs/RootCA.cer

    account username@domain.com
    host mail.domain.com
    port 443
    #auth on
    from username@domain.com
    user username
    password password
    logfile /var/log/msmtp.log

A couple of things I'm not clear about. I though our mail.domain.com would listen on something like port 25. But it doesn't; a wireshark inspection on what's going on when I start Outlook on my Windows machine reveals Outlook first trying in port 135, then failin and going for port 443. This is where TSL negotiations goes, etc.

This is why I specified port 443, but I'm not sure that's correct. We have OWA (Outlook Web Application) so we can access our corporate emails over https.

When I run something like this:

Code:
# echo "TEST" | /usr/local/bin/msmtp -a username@domain.com a_user@domain.com
^C

There's TCP establish over 443 as seen in Wireshark, but that's it.

Like I said any pointers on this would be awesome. I'd prefer not to go with something like postfix for this.

Kind Regards
 
I think our organization uses what Microsoft refers to Exchange or MAPI in order for Outlook to communicate to server.

So that would seem that regular options like POP/IMAP do not work as far as Unix clients go.

Is there an easy way to make this work?
 
Ask the Exchange administrators to allow SMTP mail submissions. They can set it up to only allow it from your server if they're worried about abuse.
 
Thanks.

I will try but I don't think they will change the global policy just for us, for one service. It's quite a bit organization. That's discouraging.

Well, I guess the only real problem with using gmail is that, because of high rate of logins for each email, gmail locks the account and treats it like a spam. I don't know how to deal with this.
 
bbzz said:
I will try but I don't think they will change the global policy just for us, for one service. It's quite a bit organization. That's discouraging.
If it's a big organization it's possible they already have a specific SMTP server. It won't hurt to ask.
 
bbzz said:
Well, I guess the only real problem with using gmail is that, because of high rate of logins for each email, gmail locks the account and treats it like a spam. I don't know how to deal with this.
Well, that could be solved by not using mail/msmtp but instead start using Sendmail again. I had to look it up but Sendmail knows about an option called confMIN_QUEUE_AGE (see the Tweaking configuration page) and that tells Sendmail that a message must sit for a minimum amount of time in the queue before it will be delivered. So if you're using a smarthost or relay like GMail then that's probably your best option to throttle the amount of outgoing deliveries a bit.
 
Back
Top