muquit / mailsend

A program to send mail via SMTP from command line
Other
295 stars 68 forks source link

Segmentation Fault when trying to use -M option #45

Closed i68040 closed 10 years ago

i68040 commented 10 years ago

Hi, I'm using Centos 6.5 and trying to use mailsend with a command like this:

mailsend -to receiver@domain2.tld -ssl -port 465 -user user@domain.tld -pass "CrappyP@ssword" -sub "Test it" -smtp box6.bluehost.com -f "user@domain.tld" -M "blah" -v -M "Test Message"

When I execute this command I see the following debug output followed by a segmentation fault. I do NOT receive the message in the receiver email account:

Connecting to box6.bluehost.com:465 Will detect IPv4 or IPv6 automatically libmsock: using getaddrinfo AF_INET IPv4 IPv4 address: 66.147.244.178 EINPROGRESS=115,EWOULDBLOCK=11 connect(): socket=3,rc=-1, errno=115 (Debug) Try socket 3 Cipher: CAMELLIA256-SHA Certificate information: Subject: /OU=Domain Control Validated/OU=PositiveSSL Wildcard/CN=*.bluehost.com Issuer: /C=GB/ST=Greater Manchester/L=Salford/O=Comodo CA Limited/CN=PositiveSSL CA [S] 220-box6.bluehost.com ESMTP Exim 4.80 #2 Sat, 01 Feb 2014 15:31:04 -0700 [S] 220-We do not authorize the use of this system to transport unsolicited, [S] 220 and/or bulk e-mail. [C] EHLO localhost [S] 250-box6.bluehost.com Hello localhost [174.52.5.6] [S] 250-SIZE 52428800 [S] 250-8BITMIME [S] 250-AUTH PLAIN LOGIN [S] 250 HELP [C] MAIL FROM: user@domain.tld [S] 250 OK [C] RCPT TO: receiver@domain2.tld [S] 250 Accepted [C] DATA [S] 354 Enter message, ending with "." on a line by itself Subject: Test it From: user@domain.tld Date: Sat, 01 Feb 2014 15:30:25 -0700 To: receiver@domain2.tld X-Mailer: @(#) mailsend v1.17b15 (Unix) X-Copyright: BSD. It is illegal to use this software for Spamming Message: blah Mime type: text/plain Disposition: inline Encoding type: (null)

Message: Test Message Mime type: text/plain Disposition: inline Encoding type: (null)

Segmentation fault

muquit commented 10 years ago

Thanks for the bug report!

i68040 commented 10 years ago

Thanks for the quick reply!

While the cli output indicates that an email was sent, it doesn't look like it worked. When I check both the sending and receiving email accounts I don't see the mesage. Is there any additional level of debug logging I can use to narrow down what could be going wrong?

Here's what console output looks like after I pulled & recompiled:

[S] 354 Enter message, ending with "." on a line by itself Subject: Test it From: user@domain.tld Date: Sun, 02 Feb 2014 09:08:49 -0700 To: receiver@domain2.tld X-Mailer: @(#) mailsend v1.17b15 (Unix) X-Copyright: BSD. It is illegal to use this software for Spamming Message: blah Mime type: text/plain Disposition: inline Encoding type: none

--/vTcePoMHBGH/LtC--

[C] . [S] 250 OK id=1W9zbs-0000cH-DQ [C] QUIT [S] 221 box678.bluehost.com closing connection Mail sent successfully

muquit commented 10 years ago

As mail was accepted my the SMTP server, nothing can be done in mailsend. It's possible the mail was discarded by SMTP server for some reason. I tested with gmail SMTP server to send mail to gmail and yahoo. There is a script test/test_onlines1.sh for sending test mail. Thanks.

i68040 commented 10 years ago

Thanks for the reply, I'll try and do more investigation to figure out what is really causing my problem.Rion Sent from my BlackBerry 10 smartphone. From: muquitSent: Sunday, February 2, 2014 12:25To: muquit/mailsendReply To: muquit/mailsendCc: i68040Subject: Re: [mailsend] Segmentation Fault when trying to use -M option (#45)As mail was accepted my the SMTP server, nothing can be done in mailsend. It's possible the mail was discarded by SMTP server for some reason. I tested with gmail SMTP server to send mail to gmail and yahoo. There is a script test/test_onlines1.sh for sending test mail. Thanks.

—Reply to this email directly or view it on GitHub.

i68040 commented 10 years ago

In case anyone else sees a 'Mail sent successfully' notification without actually receiving the email: I had to swap out all of the double-quote (") symbols with single quotes (')

To illustrate, this works:

mailsend -to receiver@domain2.tld -ssl -port 465 -user user@domain.tld -pass 'CrappyP@ssword' -sub 'Test it' -smtp box6.bluehost.com -f 'user@domain.tld' -M 'blah' -v -M 'Test Message'

And this does NOT work:

mailsend -to receiver@domain2.tld -ssl -port 465 -user user@domain.tld -pass "CrappyP@ssword" -sub "Test it" -smtp box6.bluehost.com -f "user@domain.tld" -M "blah" -v -M "Test Message"

muquit commented 10 years ago

If the password or anything has any shell meta character, it will be expanded by shell if double quotes are used. That could be the reason.