how to set the authorization in html email - html

I am sending an html email which refers to some images on amazon s3. The images need an authorization in http header. Specifically they need this:
curl -H 'Authorization: '
How can I provide that empty space authorization the the html email?

You cannot.
HTML provides no means to specify custom HTTP headers for requests.
If you were using a browser, you could use JavaScript with XMLHttpRequest to make the request and then convert the response into a data: URI and use that as the src of the image. HTML formatted email has no such option though.

Related

Html 5 video play with http headers?

How to play by adding a headers from a link with html 5?
For example:
xxxx.comv?v=36474, this link does not open without certain http headers, my question is when we want to play with html5, do we have a chance to add these http headers?
I need to add hedaers:
"authority: xxx.xxx.xy"
"user-agent: Mozilla"
"sec-fetch-dest: empty"
"accept: */*"
"origin: https://www.yyyy.com"
"sec-fetch-site: cross-site"
"sec-fetch-mode: cors"
"referer: https://www.yyyy.com/p4p.php?v=7f0baeb86d31f0bdb56d452d83020aaf52f0c7a1401c10ab10e4141629d9682b"
"accept-language: tr-TR,tr;q=0.9,en-US;q=0.8,en;q=0.7"
There are only very limited things you can do to affect the request headers sent when a link is clicked on (such as using rel="noreferrer".
You can't set arbitrary headers to arbitrary values.
If you are using XMLHttpRequest or fetch instead of a link then there are methods to set headers, but a number of the headers you want to set are forbidden, so that won't work either.

What is the syntax for using cid:attachmentID in e-mail for image file used in css

I am working on a script that e-mails some formatted html and images to recipients. Using MIME::Lite, I figured out a way to send the css file and the image file it uses as attachments. The image comes out at the end of the mail message - as an attachment. The following line appears to work:
<link href="cid:style.css" rel="stylesheet" type="text/css" />
My question is what should be the syntax for the following lines (in the file style.css)? Following does not work.
body {
background-image:url("cid:bgLine.png");
background-repeat:repeat-x;
}
Furthermore, how can I stop the mail client from showing the image by itself? Script I am using follows:
my $msg = MIME::Lite->new( From =>"from\#company\.com",
To => "to\#company\.com",,
Subject =>"Action Required",
Disposition =>'inline',
Type =>'multipart/related');
$msg->attach(Type => 'text/html', Data => qq{#htFileContents});
$msg->attach(Type => 'text/html', Id => $cssFileName, Data => qq{#cssFileContents});
$msg->attach(Type => 'image/png', Id => $imageFile, Path => $imageFile);
$msg->send("sendmail","/usr/sbin/sendmail -t");
Having the mail client access an URL for the css or the image file from an http server is not an option. The e-mail needs to be self-contained. TIA for an example showing the syntax.
This won't really work. Even if by some miracle you were able to get your attachments to see and talk to each other, Outlook won't support background images, Gmail will strip out your linked css file and any embedded css, and hotmail will not support css backgrounds.
Sounds like you need to host an HTML email somewhere that accepts dynamic parts, and trigger the send from within your application, passing it the dynamic parts to fill in before sending. Check out a tool like Lyris Listmanager or something.
There is no connection between the title and the posted question above.
Anyway, in order to send emails, showing safely images, that are attached in the email, it just not enough to refer the images with some cid: URLs.
Attaching the images to the email has the following specifics:
Replace the external URLs to images with the URLs of an attachments in the email.
The email to generate is not just multipart/mixed what is construed by default of JavaMail, but MIME multipart/related type, in order to allow the email client to use the images.
The attachments for the images must be have
Content-Disposition: inline; filename=... header, in order they not to be shown as attached files, but to allow the email client to use them.
ContentID:unique-name#domain header, where the unique-name and domain have to be replaced with actual values and keep < and >!
Example: ContentId: logo.png#paysafe.com
The references in the HTML part of the email message (the message body) happens through cid:content-id URLs, where content-id is the the value of the ContentId header of the attachment holding the image
Example:
References:
https://javaee.github.io/javamail/docs/api/ for the mail protocol-specific properties.
https://www.rfc-editor.org/rfc/rfc2392 - defines the CID: URL schema and the use of addr-spec
https://www.rfc-editor.org/rfc/rfc822 - defines addr-spec in the form: local-part "#" domain
https://www.rfc-editor.org/rfc/rfc1806 - defines Content-Disposition header
https://www.rfc-editor.org/rfc/rfc2387 - The MIME Multipart/Related Content-type - vital for image inlining

Submit a "pure" HTTP request from HTML page

I need to send the following HTTP request to my REST server from an HTML page to retrieve another page. How to do that using javascript or forms or links or whatever ?
Note that the HTTP request body must contain plain text with no key/value pairs as a form usually does.
PUT /somerequest HTTP/1.1
Host: www.myhost.com
Accept: text/html,application/xhtml+xml
Payload of the request to be read by the server script.
The script will return a HTML content to my browser.
Thanks !
You could use jQuery?
http://api.jquery.com/jQuery.ajax/
I'm sure you will find what you want there.
And if you don't look at a lower layer: XMLHttpRequest
http://www.w3.org/TR/XMLHttpRequest/

How to pass request URL to mailto body

I need to pass URL to the body part of the mailto link.
Sample URL :
www.test.com?param1=value1&param2={value2}
If i pass this URL, it's cut down after the '&'. So, i have tried to encode the URL like below:
www.test.com%3Fparam1%3Dvalue1%26param2%3D%7Bvalue2%7D
It works, but the URL is not readable. How can we achieve this without encoding or showing readable URL in the mail body?
Try this bit of code:
Send Mail' with current webpage (offline mode will send file location on disk).
When is doubt, read the specification:
http://shadow2531.com/opera/testcases/mailto/modern_mailto_uri_scheme.html
Validator available at the bottom of the page.

How to get result back from CGI(C) to the same HTML page?

Can I display the result which is processed in the CGI(using C) on the same html page, from where the CGI is invoked?
Regards,
MalarN
No, HTTP does not work that way.
You would have to make a asyncronious request (using JavaScript, this is commonly known as AJAX) instead.
In a nutshell, you can spawn a background HTTP request to your CGI process, instead of posting the browser to it in the main HTTP request.
See this: http://en.wikipedia.org/wiki/XMLHttpRequest