I guess I ran into a dot-stuffing problem sending SMTP messages. What i basically want to do is to send a message with a text and a attachment part.
In my example I defined a multipart/mixed message like following:
Mime-version: 1.0
Content-Type: multipart/mixed; boundary="YJiPVI9C2M93dRDm"
--YJiPVI9C2M93dRDm
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
Message
.
--YJiPVI9C2M93dRDm
Content-Type: application/gzip
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename=2015-06-22-114558.tar.gz
H4sIAFbZh1UCA+2dXW/dNhKGc72/QujVLtAmIocjSqdXbbH9AJJt0G63F0URuPZJYdT2MezjNP33
FXkcbyQxh6TmnX4AOTdpUs3D0ejlkOKXbGv4o7b7yNqPjHHM/ZNH8F87/jxz/HP8zf+M/20sO+PZ
--YJiPVI9C2M93dRDm--
If I send the SMTP massage with libcurl like described above i will get connection timeouts. The problem is the single point (after "Message"). I know that this is a escape sign in SMTP, but it should be interpreted as a "normal" point. So how to do this? Is the mime body correct? Do i need to masquerade the single point?
Related
I want to upload a PDF file but can't seem to serialize it correctly. Because of specific requirements I cannot use the FormDataAPI nor an HTML form.
I'm manually creating the multipart/form-data body like so.
------WebKitFormBoundaryFb3Biw9LyOW5jlUQ
Content-Disposition: form-data; name="username"
bill
------WebKitFormBoundaryFb3Biw9LyOW5jlUQ
Content-Disposition: form-data; name="file"; filename="test.pdf"
Content-Type: application/pdf
[object ArrayBuffer]
------WebKitFormBoundaryFb3Biw9LyOW5jlUQ--`
and sending the request via xhr.send(body) where body is my built up string. Is this even possible?
When I've tested using the FormDataAPI I can see the file as a nice big (encoded?) blob in the Chrome network request inspector. Is FormDataAPI doing something that I cannot achieve via JS?
I am sending mails from the command prompt as-
mail -s "$(echo -e "This is the subject\nContent-Type: text/html")" <my-email-id> < ~/Downloads/report-scripts/mail.html
The file mail.html is a perfectly written HTML file, which when viewed in browser, renders perfectly. However when sent through mail (say to Gmail), some layout issues creep in. See the following images -
Browser Image -
Mail Image -
Note the extra </td> element.
I understand that email providers don't render HTML mail as it, and add their own styles to it. Is there any way to resolve this issue?
Okay,
I have resolved the issue and I have an indication of what might be the problem, but I am not sure about it.
Using mutt instead of mail solved the issue. So the problem is linked to the mailing utility and not the HTML itself.
RCA-
I checked the original mail content. You can do that in Gmail by following the image
For mutt, the content was as follows -
From: <Some email id>
To: <Some email id>
Subject: <Some subject>
Message-ID: <20160218081616.GA6060#<machine description>>
MIME-Version: 1.0
Content-Type: text/html; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
User-Agent: Mutt/1.5.21 (2010-09-15)
and for mail, it was as follows -
Subject: <Some subject>
Content-Type: text/html
To: <some email id>
X-Mailer: mail (GNU Mailutils 2.99.97)
Message-Id: <20160215054331.4C3EA25E27#<machine-description>
Date: Mon, 15 Feb 2016 11:13:31 +0530 (IST)
From: <some email id>
I think it has something to do with the headers sent with the mail.
I am creating an application in vb.net that allows users to sign up for text updates via a simple form. When users hit the submit button on the form it will send a POST to the website with the actual sign up form and then the website accepts the data. When I go to get the HTTP POST off of the website it looks very odd and seems to change every time. I am using Live HTTP Headers to get the data. Here is a sample of the header content:
Content-Length: 952
-----------------------------61332911729981
Content-Disposition: form-data; name="_wpnonce"
1d45b60ac9
-----------------------------61332911729981
Content-Disposition: form-data; name="_wp_http_referer"
/
-----------------------------61332911729981
Content-Disposition: form-data; name="_ninja_forms_display_submit"
1
-----------------------------61332911729981
Content-Disposition: form-data; name="_form_id"
1
-----------------------------61332911729981
Content-Disposition: form-data; name="ninja_forms_field_1"
(828) 555-3949
-----------------------------61332911729981
Content-Disposition: form-data; name="ninja_forms_field_2"
unchecked
-----------------------------61332911729981
Content-Disposition: form-data; name="ninja_forms_field_2"
checked
-----------------------------61332911729981
Content-Disposition: form-data; name="_ninja_forms_field_3"
Submit
-----------------------------61332911729981--
Here is a sample of what I previously have gotten from Live HTTP Headers with a newsletter form for email alerts:
fields%5Bemail_address%5D%5Bvalue%5D=blahblah%40email.com&cc_newsletter%5B%5D=1&cc_referral_url=http%253A%252F%252Fpeabodyswineandbeer.com%252F&cc_redirect_url=&constant-contact-signup-submit=Sign+Up&uniqueformid=constant_contact_api_widget-2
Any ideas how to get the first one like the second one? I got them from the exact same section in HTTP Live Headers, but I have no idea how to use the first one to POST data to the website.
For google found that the oauth header format is
GData-Version: 3.0
Authorization: OAuth oauth_version=1.0,oauth_nonce=5887e5b11904194f7d217e9b7f795d62, oauth_timestamp=1317623602,
oauth_consumer_key=56565768768.apps.googleusercontent.com",oauth_verifier=PH9etu_6shPOPvlFgiFJS-Dd,
oauth_token=4%2Fpdn5ZtajHsU-zeSxScNSil43sTK0,oauth_signature_method=HMAC-SHA1,
oauth_signature=ybgad%2B6LlQ8P3rwnFa8BpI8awok%3D
Content-Length: 353
Content-Type: application/atom+xml
Seeing this made a request header for facebook as
Authorization: OAuth oauth_version=1.0,oauth_nonce=5887e5b11904194f7d217e9b7f795d62, oauth_timestamp=1317623602,
oauth_consumer_key=12904260719,oauth_verifier=PH9etu_6shPOPvlFgiFJS-Dd,
oauth_token=4%2Fpdn5ZtajHsU-zeSxScNSil43sTK0,oauth_signature_method=HMAC-SHA1,
oauth_signature=ybgad%2B6LlQ8P3rwnFa8BpI8awok%3D
Content-Type: application/X-WWW-form-urlencoded
What's the mistake in this header
Can anyone help me out please
Got it solved. Facebook is not expecting a header which contains parameters like oauth_nounce, oauth_consumer_key etc
I received a promotional mail from Google AdWords. Because I liked the layout, I thought of giving a look at the HTML source of the mail. When I clicked 'Show original' from the mail options, I saw no HTML code, but a bunch of encoded text.
It was something like this:
--===============0308376380==
MIME-Version: 1.0
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: base64
PG1ldGEgaHR0cC1lcXVpdj0iQ29udGVudC1UeXBlIiBjb250ZW50PSJ0ZXh0L2h0bWw7Y2hhcnNl
dD11dGYtOCIgLz4gDQo8ZGl2IHN0eWxlPSJjb2xvcjojMTExOyBmb250LXNpemU6MTIuOHB4OyBm
b250LWZhbWlseT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cjoj
.........
............
....
.....................
--===============0308376380==--
What's happening here? How the HTML is encoded? Is there a way to decode these stuff? Thanks!
The HTML is base64 encoded:
Content-Transfer-Encoding: base64
you can decode it using PHP:
echo base64_decode($text);
or online:
http://www.motobit.com/util/base64-decoder-encoder.asp
The encoding is base64. There should be modules to convert to and from base64 in almost all programming languages. However, if you are on linux, you can try:
base64 -d