Results 1 to 5 of 5

Thread: swaks:Different file types as attachment

  1. #1
    Join Date
    Jul 2008
    Location
    Sweden
    Posts
    178

    Default swaks:Different file types as attachment

    I try to include different type of files when sending mail with swaks (Swiss Army Knife for SMTP).
    html as body and pdf as attchments.
    Code:
    From="me@example.com"
    Passw="abc123"
    To="you.example.com"
    Server="smtp.example.com:587"
    Signatur="sign.html"
    
    Subjects="The subject of mail"
    Attach=" --attach-type application/pdf --attach=file1.pdf --attach=file2.pdf --attach=file3.pdf"
    
    swaks --attach-type text/htm" --body "$Signatur" --to "$To" --server "$Server" --auth-user "$From" --auth-password "$Passw" -tls --tls-protocol tlsv1_3 --h-Subject "$Subjects" "$Attach"
    With pdf as attchments the html file is not formatted in the received e-mail, but with all the fortmatting hyper text (like <br> and so on) in plain text.
    Without pdf attchments the e-mail got formated as html with fonts, colors and links.

    Is it possible to have formatted text as body and attacments in swaks?

    Log of body when sending mail with both html as body and attached pdf (resulting mail with <br> and so on)
    Code:
     ~> Content-Type: multipart/mixed; boundary="----=_MIME_BOUNDARY_000_15946" ~> 
     ~> ------=_MIME_BOUNDARY_000_15946
     ~> Content-Type: text/plain
     ~> 
     ~> <!DOCTYPE html>
     ~> <html>
     ~> <body>
     ~> 
     ~> <font size="-1">Hej,<br>
     ~> <br>
     ~> Här kommer
    ... and without pdf, if swaks command is left out with the "$Attach" (nice mail but without pdf-attachments)
    Code:
    ~> Content-Type: text/html
     ~>  
     ~> <!DOCTYPE html>
     ~> <html>
     ~> <body>
     ~>  
     ~> <font size="-1">Hej,<br>
     ~> <br>
     ~> Här kommer 
    
    ASUS G46VW running openSUSE LEAP 15.2, Windows 8

  2. #2
    Join Date
    Feb 2010
    Location
    Germany
    Posts
    4,254

    Default Re: swaks:Different file types as attachment

    @quinness:

    The Swaks “Occasionally Asked Questions” has the following –
    Another interpretation of this question is "How do I send email which has an HTML-encoded body". This means sending an email that your MUA will display as HTML. The following should work.
    Code:
    swaks --attach-type text/html --attach-body @report.html
    See the documentation for --attach-body for more information.

  3. #3
    Join Date
    Jul 2008
    Location
    Sweden
    Posts
    178

    Default Re: swaks:Different file types as attachment

    Hello, and thanks.
    Yes, that works perfectly. But when pdf also is attched with that body, the body stop working.
    swaks sends the body as text/plain instead of text/html.

    html as body is working
    Code:
    swaks --attach-type text/html --body sign.html --to you@example.com --server smtp.example.com:587 --auth-user "me@example.com" --auth-password "123abc" -tls --tls-protocol tlsv1_3 --h-Subject "Test"
    ...but same with pdf attached won't work. html as body sends as text/plain
    Code:
    swaks --attach-type text/html --body sign.html --to you@example.com --server smtp.example.com:587 --auth-user "me@example.com" --auth-password "123abc" -tls --tls-protocol tlsv1_3 --h-Subject "Test" --attach-type application/pdf --attach 1.pdf
    ASUS G46VW running openSUSE LEAP 15.2, Windows 8

  4. #4
    Join Date
    Feb 2010
    Location
    Germany
    Posts
    4,254

    Question Re: swaks:Different file types as attachment

    Quote Originally Posted by quinness View Post
    But when pdf also is attched with that body, the body stop working.
    And with “--attach-body @1.pdf” ?

  5. #5
    Join Date
    Jul 2008
    Location
    Sweden
    Posts
    178

    Default Re: swaks:Different file types as attachment

    Quote Originally Posted by dcurtisfra View Post
    And with “--attach-body @1.pdf” ?
    with @ before pdf the bode is still in plain text (with hypertext like <br>), but the attached pdf is in the beginning of the mail, before body.
    edit: tested with body, both body and attachment, and only attachment

    EDIT2: Working THANKS Missed --attach-body
    It's working, you're the best.
    ASUS G46VW running openSUSE LEAP 15.2, Windows 8

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •