• Resolved Nagilo

    (@nagilo)


    I’m trying to setup a contact form which allows the user also to upload a file. But when I try the form I get totally weird Emails. I guess it’s something about the encoding of the uploaded file. It looks to me as if the file (here a DOCX) is not attached but encoded as text (base64). Any idea?

    Here’s a sample from the Email. The allowed file-types are: pdf,docx,doc,jpeg,jpg

    Thanks, Matthias

    Content-Type: application/octet-stream; name=”noid-blabla.docx”
    Content-Transfer-Encoding: base64
    Content-Disposition: attachment; filename=noid-blabla.docx
    UEsDBBQABgAIAAAAIQBncygvlwEAACgJAAATAAgCW0NvbnRlbnRfVHlwZXNdLnhtbCCiBAIooAAC
    AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

    https://wordpress.org/plugins/cforms2/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author bgermann

    (@bgermann)

    This seems to be correct. Do you see this text in an email client (which one?) or do you see it as an attachment? If you do not see it as an attachment, please also paste some more parts of the email (including the MIME boundaries).

    Thread Starter Nagilo

    (@nagilo)

    Correct would be an Email with a file attached to it, right? Here’s more information on how I received the Email. We got a work around by storing the Email on the server but this is not what we prefer.
    The Email client is “Live Mail”.

    Content-Type: multipart/alternative;

    boundary=”b2_9e6300a07aec2bbd91dc181c5ea83daf”

    –b2_9e6300a07aec2bbd91dc181c5ea83daf

    Content-Type: text/plain; charset=UTF-8

    Content-Transfer-Encoding: quoted-printable
    =0D
    Eine neue Einreichung (form: “Mitgliedschaft II”)=0D
    =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
    =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0D
    Hinzugef=C3=BCgt am: 27. Dezember 2015=0D
    Via: /?page_id=3D176=0D
    Von 62.46.181.203 (visitor IP).=0D
    =0D
    =0D
    =0D
    ———————–Topic——————–=0D
    =0D
    Name: Max=0D
    Nachname: Mustermann=0D
    E-Mail: max.mustermann@student.uni.at=0D
    Titel: Dr=0D
    Nachweis Studienabschluss/Inskriptionsbest=C3=A4tigung: Mitgliedsantrag.d=
    ocx=0D
    Nachricht: Tset=0D
    =0D
    =0D
    –b2_9e6300a07aec2bbd91dc181c5ea83daf

    Content-Type: text/html; charset=UTF-8

    Content-Transfer-Encoding: quoted-printable
    =0D
    <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN” “http://www.w3.o=
    rg/TR/xhtml1/DTD/xhtml1-strict.dtd”>=0D
    <html xmlns=3D”http://www.w3.org/1999/xhtml”>=0D
    <head><title></title></head>=0D
    <body style=3D”margin:0; padding:0; font-family: Verdana, Arial; font-siz=
    e: 13px; color:#555;”><p style=3D”font-size: 90%; margin:0; background:#a=
    aaaaa; padding:1em 2em 1em 0.6em; color:#555555; text-shadow:0 1px 0 #c5c=
    5c5; border-bottom:1px solid #9d9d9d;”>Ein Formular wurde am 27. Dezember=
    2015 von /?page_id=3D176 [IP 62.46.181.203] eingereicht</p>=0D
    <div style=3D”background:#f0f0f0; border-top:1px solid #777; box-shadow:0=
    -2px 2px #999; -webkit-box-shadow:0 -2px 2px #999;”><span style=3D”font-=
    size: 90%; margin:0; background:#fcfcfc; padding:1em 2em 1em 0.6em; color=
    :#888888; display:inline-block;”>Mitgliedschaft II</span><table cellpaddi=
    ng=3D”0″ cellspacing=3D”0″ style=3D”width:auto; margin: 0.2em 2em 2em; fo=
    nt-size: 100%;”><tr><td style=3D”color:#555; padding:1em 0 0.4em; font-si=
    ze: 110%; font-weight:bold; text-shadow:0 1px 0 #fff;” colspan=3D”2″>Mitg=
    liedsantrag</td></tr>=0D
    <tr><td style=3D”padding: 0.3em 1em; border-bottom:1px dotted #ddd; paddi=
    ng-right:2em; color:#888; width:1%;”>Name</td><td style=3D”padding: 0.3em=
    1em; border-bottom:1px dotted #ddd; padding-left:0; color:#333;”>Eva</td=
    </tr>=0D
    <tr><td style=3D”padding: 0.3em 1em; border-bottom:1px dotted #ddd; paddi=
    ng-right:2em; color:#888; width:1%;”>Nachname</td><td style=3D”padding: 0=
    .3em 1em; border-bottom:1px dotted #ddd; padding-left:0; color:#333;”>Sch=
    renk</td></tr>=0D
    <tr><td style=3D”padding: 0.3em 1em; border-bottom:1px dotted #ddd; paddi=
    ng-right:2em; color:#888; width:1%;”>E-Mail</td><td style=3D”padding: 0.3=
    em 1em; border-bottom:1px dotted #ddd; padding-left:0; color:#333;”>eva.s=
    chrenk@edu.uni-graz.at</td></tr>=0D
    <tr><td style=3D”padding: 0.3em 1em; border-bottom:1px dotted #ddd; paddi=
    ng-right:2em; color:#888; width:1%;”>Titel</td><td style=3D”padding: 0.3e=
    m 1em; border-bottom:1px dotted #ddd; padding-left:0; color:#333;”>Mag</t=
    d></tr>=0D
    <tr><td style=3D”padding: 0.3em 1em; border-bottom:1px dotted #ddd; paddi=
    ng-right:2em; color:#888; width:1%;”>Nachweis Studienabschluss/Inskriptio=
    nsbest=C3=A4tigung</td><td style=3D”padding: 0.3em 1em; border-bottom:1px=
    dotted #ddd; padding-left:0; color:#333;”>Mitgliedsantrag.docx</td></tr>=
    =0D
    <tr><td style=3D”padding: 0.3em 1em; border-bottom:1px dotted #ddd; paddi=
    ng-right:2em; color:#888; width:1%;”>Nachricht</td><td style=3D”padding: =
    0.3em 1em; border-bottom:1px dotted #ddd; padding-left:0; color:#333;”>Ts=
    et</td></tr>=0D
    </table></div>=0D
    </body></html>=0D
    =0D
    =0D
    =0D
    –b2_9e6300a07aec2bbd91dc181c5ea83daf–

    Content-Type: application/octet-stream; name=”noid-Mitgliedsantrag.docx”

    Content-Transfer-Encoding: base64

    Content-Disposition: attachment; filename=noid-Mitgliedsantrag.docx

    UEsDBBQABgAIAAAAIQBncygvlwEAACgJAAATAAgCW0NvbnRlbnRfVHlwZXNdLnhtbCCiBAIooAAC

    AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

    AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

    AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

    AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

    AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

    AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

    AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

    AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

    AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADE

    Plugin Author bgermann

    (@bgermann)

    There should be somthing like

    Content-Type: multipart/mixed;
    	boundary="xxx"

    in your mail header and some --xxx before your first line Content-Type: multipart/alternative;

    Additionally, there should be some --xxx befor your line Content-Type: application/octet-stream; name="noid-Mitgliedsantrag.docx" and some --xxx-- after the base64 encoded docx.

    By the way: emails have to use some binary to text conversion for attachments as they are text messages. base64 is the common conversion. So that is not a problem.

    How do you send the emails? Any additional plugin to use SMTP instead of PHP’s mail() function?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘File Upload Encoding’ is closed to new replies.