HylaFAX The world's most advanced open source fax server

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [hylafax-users] EMail to fax with a separate mail server



Rolf-

On Mon, Feb 9, 2009 at 10:00 PM, Rolf Ackermann <rolf.ackermann@xxxxxxx> wrote:
> Hi folks
>
> Has anybody an idea how to create a email-to-fax service if the email
> server and the fax server are on different machines?

What I do is I use a custom python script to send the email using SMTP
and not sendmail.
I have a python script that accepts the same arguments that get passed
to sendmail
and then I set the SENDMAIL environment variable in FaxDispatch to that script:

The python script looks like this (this is for Hylafax+ 5.2.8):

if __name__ == '__main__':
    if len(sys.argv) < 2:
        sys.exit(1)

    from_addr = to_addr = None

    parse_msg = False

    optlist, args = getopt.getopt(sys.argv[1:], 'f:oi:t')
    for arg, v in optlist:
        if arg == '-f':
            from_addr = v
        elif arg == '-i':
            to_addr = v
        elif arg == '-t':
            parse_msg = True

    if not from_addr or not to_addr:
        sys.exit(2)

    to_addr_set = False

    msg = ''
    for line in sys.stdin:
        if line[:3] == 'To:' and not to_addr_set:
            to_addr = line[4:]
            to_addr_set = True
        msg += line

    to_addr_list = to_addr.split(',')

    server = smtplib.SMTP('mail.mycompany.com')
    server.sendmail(from_addr, to_addr_list, msg)



>
> Kind regards from switzerland
>
> Rolf (aka spieler67)

-- James

>
>
> ____________________ HylaFAX(tm) Users Mailing List _______________________
>  To subscribe/unsubscribe, click http://lists.hylafax.org/cgi-bin/lsg2.cgi
> On UNIX: mail -s unsubscribe hylafax-users-request@xxxxxxxxxxx < /dev/null
>  *To learn about commercial HylaFAX(tm) support, mail sales@xxxxxxxxx*
>
>


____________________ HylaFAX(tm) Users Mailing List _______________________
  To subscribe/unsubscribe, click http://lists.hylafax.org/cgi-bin/lsg2.cgi
 On UNIX: mail -s unsubscribe hylafax-users-request@xxxxxxxxxxx < /dev/null
  *To learn about commercial HylaFAX(tm) support, mail sales@xxxxxxxxx*




Project hosted by iFAX Solutions