mutt automatically add CR to newline when attaching a file? - email

I have just started using Mutt and I have a minimal configuration just to be able to send mail. I can send mail OK, the problem is when I try to attach a source file, the file's new line characters are automatically translated from LF to CRLF. I can confirm this by using hexdump. I also suppose that this problem originates from Mutt, because the problem doesn't appear when using other mail clients (like Gmail).
My .muttrc looks like this:
set from="Anh Le <anhlq2110#gmail.com>"
set imap_user=anhlq2110#gmail.com
set smtp_url="smtps://anhlq2110\#gmail.com#smtp.gmail.com/"
set editor="vim"
set markers=no
set include=yes
set forward_format="Fwd: %s"
I've searched around for this problem but can't find any useful information. Any help would be appreciated.

I think the problem is that, when you send mail is in HTML format, in this case, you have to add
<br>
at the end of line.

Related

tSendMail - New Line Trouble

I am trying to create an email with the some job status information, which I wish to put across multiple lines. However, whatever I do, I get the output in one line. Have changed the MIME type to HTML, used "\n", "\r", "\r\n", String Objects newline. Nothing seems to work.
Although I noticed that these characters do get processed, even though the outcome isn't as expected. I don't see them in the email body, which suggests that the text processor accepts them. Just doesn't process them they way it should. Do I see a bug in the component?
I am on Talend Open Studio 7.0.1, on Ubutntu 16.04.4 VM, on Windows 10 system (if that helps).
HTML < BR > works.
I tried it earlier but looks like I didn't structure my html tags well so it failed. Did it from start and got it right.
Guess what - The more you try, the more you learn. :)

Procmail mail to file

i want to configure procmail. Right now i've got code to redirect mails with selected topic from server mail to my mail. It's my code:
:0 c
*Subject.*ExampleTopic
Example#Mail.com
I want to copy mail content to selected .txt file on server. How can i do it?
Your current code saves a copy to a folder named Example#Mail.com. To save to a file with a different name, simply change that string. (To forward each matching message to another email address, the syntax is ! Email#example.com with an exclamation mark as the action "verb".)
The default saving action appends to a flat text file in Berkeley mbox format. This includes both the headers and the body. With a b flag you can save just the email body, but this is still the raw MIME transport format, which is very rarely what you actually want.
:0b
* some condition, perhaps
bodyfile.txt
Procmail regrettably knows nothing about MIME, so if getting a particular body part is what you actually need, you'll probably want to pipe the message to some script which understands MIME and can implement your extraction policy.
:0
* some condition, maybe
| extracttool >>bodyfile.txt
The vague wording of your question implies that you are probably not too familiar with the details of email formatting in general and MIME in particular. You'll probably want to post another question with more detailed requirements once you have a proper idea of what the challenges are. For a start, the source of a message you want to mainpulate might help us help you.

Fail2ban add more info to email notificationd

I'd like to append the relevant fail2ban log entry to the notification email I already receive for any given incident.
Does anybody know how this can be done?
It depends on what information you would like - you may edit the appropriate action.d configuration file's actionban segment by copying the .conf version to a .local version which will override the .conf version as per the fail2ban documentation, and edit it to include whatever information you would like. For example, I have personally amended my sendmail-whois.conf (which is the main sendmail action I use - you could do likewise with sendmail.conf however if you use that for example) by copying it to sendmail-whois.local which I then edited to include the server hostname on the 'From:' line.
You could also include commands to be executed with their output passed to the email to be sent, as long as you follow the correct syntax and fully qualify the path to the relevant commands - for example, you will see that the sendmail-whois action configuration contains the line, within the actionban segment;
`/usr/bin/whois <ip>`\n
Note, as I have mentioned above - the full path to the relevant command is included (in this case, for whois), and the entire command with its options must be delimited by backquotes. the \n at the end of the line indicates that a new line be printed following this one in the output.
Hope that clarifies things for you!

Send Ctrl+Z to serial port via command line

I am trying to send the following to the COM1 serial port via command line using ECHO or similar (I've also tried downloading a small program called serialsend, but I am stuck with how to send the equivalent of CTRL+Z. This is to send a SMS message via a Siemens TC35 GAM module. I am able to do it via Hyperterminal as a test and it works fine, but I cannot figure out how to send the CTRL+Z at the end to confirm the ned of the message.
This is what I have:
AT
AT+CMGF=1
AT+CMSG="+xxxxxxxxxxx"
HELLO
Now, after Hello, which is the message I want to send, I have to send CTRL+Z. But cannot figure out how to do it, I have tried this:
AT
AT+CMGF=1
AT+CMSG="+xxxxxxxxxxx"
HELLO
\x1A
As I read somehwere that this would be the equivalent of doing it, but it hasnt worked.
Can anyone help me with this? I have found solutions, but they are not command line, which is what I need.
I have also tried using this format:
ECHO AT > COM1:
But as I don't know how to send CTRL+Z I don't know if it is working.
I wrote the free command line program SerialSend that you mentioned. Since this question was originally posted, I've added an extra feature that allows arbitrary byte values to be included (in hex format) in the text you're sending via the serial port. For example, to send Ctrl-Z (26 decimal, 0x1A hex), just use the following command:
SerialSend /hex "\x1a"
Port name/number, baudrate, etc can be configured with additional command line arguments. For example,
SerialSend /baudrate 9600 /devnum 2 /hex "\x1a"
For more details, see the SerialSend home page.
Hope that helps!
Ted
Use this:
port.Write(txt_msgbox.Text + char.ConvertFromUtf32(26));
It works :)
type this command Serial.println((char)26); in Arduino code ... one square box will appear on serial monitor. Copy that square and paste in Notepad++. It will be displayed as SUB with black background. wheneever you want to type cntrl+z, just copy this SUB and paste in serial monitor. It works.

Is there a difference between the Outlook .MSG and .OFT file formats?

This question is somewhat of a long shot, but I've spent hours on it to no avail. I have some code that generates an email file on a webserver, and allows the user to download that email and open it in Outlook. From here, they can make various manual changes to the email before they send it to a bunch of people.
Right now, I generate a .OFT file, which is basically an email template. What I want to do is generate a .MSG file, which is an actual email. From a binary point of view, it seems these file formats are identical. They have the same Stream IDs and properties and stuff.
My approach was to first create a blank email message in Outlook and then just save it to a file called Base.oft. In my code, I open the document and modify Stream ID __substg1.0_1013001E which is the ID for the HTML email body. I then save the file and write it out to the cilent. This works perfectly.
I tried the same approach with the MSG format. I created a blank email message, saved it as Base.msg, and modify the same Stream ID. If I look at the resulting file, the new body is actually in there and saved. However, if I open the email, the body is still blank.
What's even weirder is if I type in a body in Outlook and save that to the base file, I can see that body under stream 0_1013001E. If I then modify that stream with a different body, I can verify the new body is indeed saved in the file, but if I open the message in Outlook, I see the old, original body. It's as if the email body is stored in a different place in the file for the .MSG format, however I've looked through each stream and cannot find anything else that looks like it could be an email body.
Perhaps .MSG files are encrypted, or their bodies are stored in some proprietary binary format unlike .OFT files? Hopefully someone has some insight on this, as I scoured the Internet and found basically nothing on these formats.
Update:
It seems the .MSG format stores the body in Stream ID __substg1.0_10090102 - Which is encoded in some binary form (not sure what.) If I delete the stream (or set it to a single \0, the file becomes corrupt.
First of all, to find more information on this and related topics, move away from raw substream numbers and google for the corresponding MAPI properties. For example, 1013 is PR_HTML and 1009 is PR_RTF_COMPRESSED. MAPI has ways of synching the body from one format to the other.
See this article on MSDN for a good overview of all content-related MAPI properties (i.e. the different "streams" inside the .MSG file).
To write PR_RTF_COMPRESSED, wrap the stream inside WrapCompressedStream. On the other hand, in your particular situation you might want to avoid the MAPI-dependencies in your code, so maybe you're better off finding the PR_STORE_SUPPORT_MASK and setting the STORE_UNCOMPRESSED_RTF bit. This will allow you to use straight RTF in the PR_RTF_COMPRESSED substream. Or Outlooks fancy html-wrapped-in-rtf, if you are feeling brave.
None of this stuff is for the faint of heart, but seeing how you are already handing raw .MSG substream writing, I'm guessing it would be feasible.
When it comes to the format, there is no difference.
the only difference is that OFT files have CLSID_TemplateMessage ({0006F046-0000-0000-C000-000000000046}) as the storage class (WriteClassStg), while MSG files use CLSID_MailMessage ({00020D0B-0000-0000-C000-000000000046})