I'm using following script to embed multiple image on a mail using sendmail function.
sendmail -t <<EOT
TO: example_to#xyz.com
FROM: example_from#xyz.com
Cc: example_cc#xyz.com
SUBJECT: Phobos Report
MIME-Version: 1.0
Content-Type: multipart/related;boundary="XYZ"
--XYZ
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 7bit
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-15">
</head>
<body bgcolor="#ffffff" text="#000000">
<img src="cid:part1.06090408.01060107" alt=""><br/>
<img src="cid:part2.06090408.01060107" alt=""><br/>
<img src="cid:part3.06090408.01060107" alt="">
</body>
</html>
--XYZ
Content-Type: image/jpeg;name="rag1.jpg"
Content-Transfer-Encoding: base64
Content-ID: <part1.06090408.01060107>
Content-Disposition: inline; filename="rag1.jpg"
$(base64 rag1.jpg)
--XYZ
Content-Type: image/jpeg;name="rag2.jpg"
Content-Transfer-Encoding: base64
Content-ID: <part2.06090408.01060107>
Content-Disposition: inline; filename="rag2.jpg"
$(base64 rag2.jpg)
--XYZ
Content-Type: image/jpeg;name="rag3.jpg"
Content-Transfer-Encoding: base64
Content-ID: <part3.06090408.01060107>
Content-Disposition: inline; filename="rag3.jpg"
$(base64 rag3.jpg)
--XYZ--
EOT
Here only the first image getting embedded. And all the others are failed to get added. Those two images are added as text based attachment. How can I add multiple images on this script?
It is an old question, but I think it deserves an answer anyway.
The problem with your code is that you are putting empty lines between the MIME boundary and the MIME headers of the last two images, as here:
--XYZ
Content-Type: image/jpeg;name="rag2.jpg"
Content-Transfer-Encoding: base64
Content-ID: <part2.06090408.01060107>
Content-Disposition: inline; filename="rag2.jpg"
This is not allowed. You should correct your code and delete those empty lines in two places, as follows, here:
--XYZ
Content-Type: image/jpeg;name="rag2.jpg"
Content-Transfer-Encoding: base64
Content-ID: <part2.06090408.01060107>
Content-Disposition: inline; filename="rag2.jpg"
and here:
--XYZ
Content-Type: image/jpeg;name="rag3.jpg"
Content-Transfer-Encoding: base64
Content-ID: <part3.06090408.01060107>
Content-Disposition: inline; filename="rag3.jpg"
Empty lines are allowed before the boundary line, which means that they will be part of the preceding body, where they are usually harmless (but I can make up contexts where they wouldn’t be. It’s not your case, however.)
It’s best never to put extra empty lines on either side of MIME boundaries. Of course, this is not about the empty line needed before the first MIME boundary, where it separates the MIME header.
try to do it without line break tag
<img src="cid:part1.06090408.01060107" alt="">
<img src="cid:part2.06090408.01060107" alt="">
<img src="cid:part3.06090408.01060107" alt="">
tested it myself and it is working fine
Related
I am trying to update my Tabulator table from a JSON file. When an item is submitted or deleted, it triggers a PHP file that updates the file fine. However, the table does not update. If I hard reload the page (CTRL+F5), the table updates correctly. Otherwise, it will not update with a regular reload. I have a location.refresh(); in my code for deleting with a successful ajax request to my PHP file. My PHP files have a "Refresh:0; url = tabulator.html". I have tried adding to the top of my html page:
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
and to the top of my PHP file:
header('Cache-Control: no-cache, no-store, must-revalidate'); // HTTP 1.1.
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache'); // HTTP 1.0.
header('Expires: 0');
At the end of my table creation i have table.setData(); since I use an ajaxURL to load the data in the table. Anyone have any idea how I can refresh the table with the data from the JSON file when an item is submitted or deleted? Thanks in advance.
use reactiveData:true, //enable reactive data
checkc documentation
When I check the documentation on Developer.ATT.com I see this example of the format (Code)I should use:
POST https://api.att.com/speech/v3/speechToTextCustom HTTP/1.1
Host: api.att.com
Authorization: Bearer 38C2399A23999
X-SpeechContext: GrammarList
Accept: application/json
Content-length: 7012
Content-Language: en-us
Content-type: multipart/x-srgs-audio; boundary=----------------------------46ef33c653e2
------------------------------46ef33c653e2
Content-Disposition: form-data; name="x-dictionary"; filename="speech_alpha.pls"
Content-Type: application/pls+xml
<?xml version="1.0" encoding="UTF-8"?>
<lexicon version="1.0" alphabet="sampa" xml:lang="en-US">
<lexeme>
<grapheme>Qiang</grapheme>
<phoneme>tS { n</phoneme>
</lexeme>
</lexicon>
------------------------------46ef33c653e2
Content-Disposition: form-data; name="x-grammar"
Content-Type: application/srgs+xml
<grammar root="top" xml:lang="en-US">
<rule id="CONTACT">
<one-of>
<item>Qiang</item>
<item>David</item>
</one-of>
</rule>
<rule id="top" scope="public">
<item>
<one-of>
<item>text</item>
<item>send message to</item>
</one-of>
</item>
<ruleref uri="#CONTACT"/>
</rule>
</grammar>
------------------------------46ef33c653e2
Content-Disposition: form-data; name="x-voice"; filename="speech_ex.amr"
Content-Type: audio/amr
{{...audio data...}}
------------------------------45ef33c653e2--
Since I am having trouble getting this to work I am wondering if I should include the dictionary and grammar parts of the post as well? Why?
To use the customspeech engine (for non-standard languages) the grammar file is required as you need to supply the vocabulary for transcription whenever using the customspeech engine.
You are able use the regular speech API for transcription with no grammar file but it may not cover what you are trying to do.
It looks like you are trying to take advantage of the large number of non-English languages available with the AT&T customspeech engine. All of those languages do require that you supply a grammar file in order to work.
Supported non custom languages are American English and American Spanish.
I have a very strange problem with a webpage I made with Node.js + Express.js.
My webpage is multilanguage (English/Spanish), so in the Jade templates I have translations IDs which correspond to a text depending on the selected language. Ok, that works well.
Now, when I search the webpage in Google, it appears on the first result without problems, but in the description it shows me the translation IDs, not the rendered text. It's very strange because the translation is supposed to be made on the server side, isn't it?
The problem seems to be that there isn't a default language and Google's web crawlers don't seem to specify a preference.
The i18n seems to be reasonably based on the Accept-Language request header:
curl --header 'Accept-Language: en-US,en' http://www.porcupinee.net
<div id="why" class="row">
<h2>Why should you choose us?</h2>
<h3 class="text-center">We are young developers focused to the web</h3>
<!-- ... -->
curl --header 'Accept-Language: es' http://www.porcupinee.net
<div id="why" class="row">
<h2>¿Por qué debería elegirnos?</h2>
<h3 class="text-center">Somos jóvenes desarrolladores enfocados a la web</h3>
<!-- ... -->
But, no substitution is performed without that header or when another language is specified:
curl http://www.porcupinee.net
curl --header 'Accept-Language: de' http://www.porcupinee.net
<div id="why" class="row">
<h2>why.title</h2>
<h3 class="text-center">why.we.title</h3>
<!-- ... -->
I have a view in which the MIME type returned varies. How do I set the content type in the head section?
Here is what I am trying to do
!!!
html
head
title #{site.title} - #{site.version}
link(rel='stylesheet', href='/stylesheets/style.css')
script(type='text/javascript', src='/javascripts/jquery-1.5.1.min.js')
content-type #{mimetype}
body!= body
You can specify the content-type meta tag like so:
meta(http-equiv="content-type", content="#{contentType}; charset=UTF-8")
Remember that the tag for content-type is <META ...
What is the solution to correctly display french characters in all browsers? now i get in some browsers this: (pr�sent�s)
Thanks.
One solution is to learn how to use Unicode.
The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!)
Try UTF-8 encoding on all your pages and encoding all your strings to UTF-8.
You should specify a content type for the page, and specify what encoding you use for creating the page. Example:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
You need to select a character encoding for your page. In your editor, save to that encoding, and specify in the HTML <head> section:
<meta http-equiv="Content-Type" content="text/html; charset=The_Chosen_Encoding" />
Suitable encodings for French include ISO-8859-1 (aka Latin-1) and UTF-8.
Alternatively, you may stick to plain ASCII and use HTML entities for the accentuated letters, such as:
é for é
è for è
etc.
Just use this in you html
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
and if you're using php additionally this in your php-script
header ('Content-type: text/html; charset=utf-8');