muquit / mailsend-go

mailsend-go is a multi-platform command line tool to send mail via SMTP protocol
Other
168 stars 16 forks source link

Line break in sent messages #25

Closed drdunn858 closed 4 years ago

drdunn858 commented 4 years ago

How can I insert a line break in the message being sent as it is a long message?

muquit commented 4 years ago

mailsend-go -ex

body -msg "hello, world!\nThis is a message"

The embedded new line \n will be converted to a real newline and the final message will show up as two lines.

drdunn858 commented 4 years ago

Thank you, but this does not work, however, after a lot of attempts, I found that formatting as html ie body -msg "

hello, world!</>

This is a message

" worked for me.

Wolf-SO commented 4 years ago

Wouldn't is be possible that this depends on the \n convention of the operation system? The handling of \n could be different between Go and C - I only know that C treats \n in text files (which is the default) as the actual OS line break encoding. Go may be different here. I'm just guessing, but Questions like Golang: Issues replacing newlines in a string from a text file - Stack Overflow seem to support my assumption.

muquit commented 4 years ago

I tested it by sending mail from Linux, Mac and Windows to gmail and another email provider. It works. I used the script test/test_body_txt.sh.

body -msg 'This is a text message in mail body.\nThis is a new line.\nThis another new line'

The mail in gmail and in other mail provider looks correct.

This is a text message in mail body.
This is a new line.
This another new line

I'm not sure what I'm missing here. Thanks.

Wolf-SO commented 4 years ago

I see. I was a bit confused by the last response by @drdunn858 and so I tried to figure out (theoretically) what could be the reason. (I'm currently not actively using mailsend-go but I was for mailsend and plan a future use.) Sorry if my comment only added more confusion.

drdunn858 commented 4 years ago

My response somehow caused confusion I had to use < p > and < / p > etc to format as html, but the site converted it to the message. In windows 10, the \ n did not work. (I added spaces to see if it would look right.)

On Thu, Apr 2, 2020 at 11:59 PM Wolf-at-SO notifications@github.com wrote:

I see. I was a bit confused by the last response by @drdunn858 https://github.com/drdunn858 and so I tried to figure out (theoretically) what could be the reason. (I'm currently not actively using mailsend-go but I was for mailsend and plan a future use.) Sorry if my comment only added more confusion.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/muquit/mailsend-go/issues/25#issuecomment-608265423, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHWYI53IMFZNI25RV5RNAIDRKWCOLANCNFSM4LZOCYZA .

--

PRIVILEGED AND CONFIDENTIAL

This e-mail message (including attachments) is covered by the Electronic Communications Privacy Act, 18 U.S.C. §§ 2510-2521, and is protected by work product privilege. It is intended only for the person or entity to which it is addressed and the privileges are not waived by virtue of this having been sent by electronic mail transmission. Any unauthorized review, use, disclosure, dissemination, copying, forwarding or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail or telephone and destroy all copies of the original message. If you are the intended recipient but do not wish to receive communications through this medium, please so advise the sender immediately.

drdunn858 commented 4 years ago

I had to use <p>Line 1</p><p>Line 2</p> as Line 1 \n Line 2 did not work in windows 10 sending to gmail or live from gmail.