SMTP user name and password using HTTPServer
lfreeze
Posts: 174
After an awful lot of failed tests, I thought it best to appeal for help!!!
I am using HTTPServer I plugged in the email Code from the tutorial. I noticed at the very bottom of the tutorial page this item:
Your SMTP server might require a username and password. Is so, the username and password must be base 64 encoded
My SMTP server does require both user name and password. I converted both items
To base64, but have no idea how to plug them into the email program. Suggestions about
how to do this will be greatly appreciated.
Thank you.
Larry
I am using HTTPServer I plugged in the email Code from the tutorial. I noticed at the very bottom of the tutorial page this item:
Your SMTP server might require a username and password. Is so, the username and password must be base 64 encoded
My SMTP server does require both user name and password. I converted both items
To base64, but have no idea how to plug them into the email program. Suggestions about
how to do this will be greatly appreciated.
Thank you.
Larry
Comments
Otherwise add the username and password as two more socket.tcp tx to the SMTP conversation.
Username and password (base64) in the modified email section. I included the Additional DAT items.
I then used the RTC to generate an email once each minute at the 40 second mark
The program (attached) loads and runs. It hangs at conversation log and no email is generated.
For security I xxxxD out some of the obvious items.
I dont know how to proceed, I have double checked my Comcast settings, and find they are correct.
Please point me in the right direction
Thanks.
Larry
For testing purposes I configured the Spinmail demo from Beau Schwabe. Here are the settings
I used in Spinmail
MACaddr byte "00:08:DC:16:F3:E3",0 '<-- Your Spinneret Hardware MAC address
IPaddr byte "192.168.2.99",0 '<-- Your Network Spinneret IP address
GWaddr byte "192.168.2.1",0 '<-- Your Network Spinneret Gateway address
''
SMTPport word 587 '<-- SMTP port (program designed for port 587)
SMTP byte "{smtp.comcast.net}",0 '<-- Your SMTP server providers name
IPsmtp byte "68.87.26.155",0 '<-- Find this by pinging your SMTP server name
''
UserName byte "xxxxxxx@comcast.net",0 '<-- Your E-mail (must be registersd with SMTP)
Password byte "xxxxxxxxxxxxxxxxxxx“,0 '<-- This is base64 encoded before it is sent
T0 byte "xxxxxxxxx@comcast.net",0 '<-- Who you are sending to (any valid address)
Subject byte "[SpinMail] - Test",0 '<-- Subject line of E-mail
''
Body byte "This is a test E-mail message sent from a Spinneret !",13,10,13,10
byte "Thanks for playing",13,10,13,10
byte "Beau Schwabe",0
I loaded and ran it, it worked and produced emails. I used the same settings in HTTPServer and could not get it to work. I think I have some fat finger, bonehead mistake in the Modified HTTServer, but cannot find it.
Any thoughts or comments would be appreciated.
Larry
Here's a how to - Note: AUTH LOGIN has a space between AUTH and LOGIN.
http://technet.microsoft.com/en-us/library/aa995718%28v=exchg.65%29.aspx
Once you get telnet SMTP working, the SPIN logic will be a breeze.
Lastly, I'm not sure about the RTC/eMail COG process. First, the process starts before any socket are initialized. That's probably okay but the SendTestEmail method assumes the socket is already up and running. Also, consider testing the SMTP code by itself until you get the emails going. Otherwise there are too many moving parts.
Your suggestion got me going in the right direction. After a few failed attempts,
I was able to telnet an email message via Comcast. I saved the log and will use it to
back in the logic statements into the program. Without your generous help, I would still
be stuck in the mud, thank you!
Larry
I carefully followed the email portion of the Spinneret Setup tutorial, but still no luck. I set up a telnet Session and added
the to:, from:, subject: and body: commands to the telnet sessions, I tried it many times and each was successful.
I modified httpserver with port2, emailip and emailport. I added the to:, from:, subject: and body: commands, to
the httpserver program. I ran the program and it produced the following conversation log. It was not successful , no emails
were received, obviously I have made a mistake as the commands I added are not being referenced in the conversation log.
The modified httpserver program is attached.
I have xxxd out my address info to delay the spammers.
Conversation Log
220 omta21.westchester.pa.mail.comcast.net comcast ESMTP server ready
250 omta21.westchester.pa.mail.comcast.net hello [68.44.187.178], pleased to meet you
334 VXNlcm5hbWU6
334 UGFzc3dvcmQ6
235 2.7.0 ... Authentication succeeded
250 2.1.0 <xxxxxx@comcast.net> sender ok
250 2.1.5 <xxxxxx@comcast.net> recipient ok
354 enter mail, end with "." on a line by itself
250 2.0.0 Vrwo1l00M3rNTWC3hrwqTu mail accepted for delivery
221 2.0.0 omta21.westchester.pa.mail.comcast.net Comcast closing connection
Disconnect and reset socket: 2
Thank you .Larry
I noticed in the posted source there are two TO and FROM parameters. One set is invoked after the DATA command. I tried that as well and it worked but I suppose it can cause problems. There should only be one FROM. But doing so seems to create an email spoof. The email could get picked up by SPAM monitors or virus checkers.
I haven't tried doing anything with email yet so I can't help you much- however, I have a suggestion that may or may not help. It helped a lot with using the spinneret as an FTP client, and you might have success with it for your smtp stuff. With FTP, you generally need to receive a response after each command to ensure the server actually processed the command correctly (or not) before sending the next command.
Since the mail server is returning responses with each command you send, try this:
Send your first string
Get your response.
Send your next string
Get your response.
On and on.
Getting your response can be a simple method with a loop this:
By doing this, you'll be getting the response from each command and you can "do something" if you timeout before you get a response. Your conversation log will be more dynamic, and the "Cancel_Mail" method can be anything you want- a pst message, an abort (with or without value) etc etc.
It's not a perfect method for getting responses, but it certainly helps to let you see what's happening each step of the way.
Your SendTestEmail method have something like this for each chunk of information you're sending to the server:
Thanks for the suggestion, I incorporated it into httpserver 4 29 2013 M. The results showed that the
Server accepted everything up to and including the “data” command. The server ignored
(no response) Everything after that up to the “.” command then continued and closed the connection.
I’m stumped!!
I then did a telnet session from the command line, using the same statements. It was successful.
This is what the command line telnet session looked line:
220 omta24.westchester.pa.mail.comcast.net comcast ESMTP server ready
ehlo smtp.comcast.net
250-omta24.westchester.pa.mail.comcast.net hello [68.44.187.178], pleased to meet you
250-HELP
250-AUTH LOGIN PLAIN
250-SIZE 36700160
250-ENHANCEDSTATUSCODES
250-8BITMIME
250-STARTTLS
250 OK
auth login
334 VXNlcm5hbWU6
bxxxxxxxxxxxxxxxxx0Lm5ldA==
334 UGFzc3dvcmQ6
TxxxxxxxxxxxxxxxMjM=
235 2.7.0 ... Authentication succeeded
mail from:xxxxxx@comcast.net
250 2.1.0 <xxxxxxx@comcast.net> sender ok
rcpt to:xxxxxxxx@comcast.net
250 2.1.5 <xxxxxxxx@comcast.net> recipient ok
data
354 enter mail, end with "." on a line by itself
to:xxxxxx@comcast.net
from:xxxxxxxx@comcast.net
subject:test message
test message via telnet session
.
250 2.0.0 WEn11l00D3rNTWC3kEoRqg mail accepted for delivery
quit
221 2.0.0 omta24.westchester.pa.mail.comcast.net comcast closing connection
Connection to host lost.
The desktop I was using to receive the emails from the spinneret did not have the
email account spinneret was sending to activated on it.
I am still confused about why I was able to telnet a good Email message to
the same email address. I will not argue with success. Thanks for your help, the
monitoring method forced me to continue testing and Eventually reach a solution.
Larry
I see this in your posted code:
Silly as it may seem, it says to enter a "." on a line by itself. Perhaps removing the cr 13 will do the trick. You've stated your responses from the server were fine up to and including the "data" command... at that point, the server is waiting for your stuff, followed by a "." and then it processes the stuff. It's also fine AFTER your stuff, because it accepted and processed the QUIT command. So it didn't get the correct data format for all your stuff.
Just a guess. Good luck.
I like using WireShark to monitor network traffic. It's a big help to see requests and responses flying by on the screen. The learning curve is not too steep.
Par with going to the dentist. Happily for my simple project it worked out okay. I will
Take a look at “wireshark” hopefully it is not to far above my skill set.
Larry