473,507 Members | 2,377 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SMTP listener corrupting HTML

6 New Member
I have an SMTP listener that accepts incoming connections and routes the message to a folder using FileStream. I have to add x-sender: email@address.com and x-receiver: email@address.com to the first two lines of the file so it can be put in a pickup folder for relay later. It seems as though this way of handling the incoming stream is corrupting the HTML in the email message body. Does anyone have a clue what I am doing wrong or a suggestion that would point me in the right direction regarding what I am missing?
Jan 30 '09 #1
7 2468
Plater
7,872 Recognized Expert Expert
This is all code you wrote yourself I am assuming?
Are you actually acting as a pop3 client or as an smtp server?
You should be able to look at whatever comes after the DATA line, up until you receive a . (period) on a line by itself.
Jan 30 '09 #2
LogicMechanic
6 New Member
I did not write the smtp, I canabalized some code. It is working nicely, listening on a port for incoming connections, responding well, and accepting the incoming byte stream of the message on a socket. When it gets to the MAIL command, I have to parse out the from and to email addresses to format the file for relaying. (I have to add x-sender: email@address.com and x-receiver: email@address.com to the first two lines of the file) It all seems to be working well except sometimes the HTML part of the message ends up with strange characters or a bunch of spaces (not &nbsp). I am wondering if the streamwriter or the byte array could be messing with the characters or if there is something i am not aware of. The only thing I could think was that each byte is in a format like ASCII or unicode or something like that and when it is output again the characters output as something different...but only sometimes.

I am sure you can tell I am new to this, so please bear with me and thank you for your help...
Jan 30 '09 #3
Plater
7,872 Recognized Expert Expert
Hmm, I would certainly suspect that character encoding as a possibility.
Is the encoding type listed as a header or anything in the email?
Its probably coming in as unicode and the .net code defaults to ASCII
(or vice-versa)
Jan 30 '09 #4
LogicMechanic
6 New Member
Dim iBytes As Integer = ServerSocketForClient.Receive(byteArray, byteArray.Length, 0)
Dim MessageFromClient As String = Encoding.ASCII.GetString(byteArray)

This is what accepts the incoming stream. Do you have a better idea?
Jan 30 '09 #5
Plater
7,872 Recognized Expert Expert
Well if there were non ascii characters in there, they would get mangled with that call I think.

Can you try using the UTF8 encoder instead and see what results you get?
Jan 30 '09 #6
LogicMechanic
6 New Member
I will try that. Is there anyway to preserve the binary stream without altering it in anyway?
Jan 30 '09 #7
Plater
7,872 Recognized Expert Expert
Don't make the conversion to string on that byteArray variable.
Jan 30 '09 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

7
2320
by: Nancy | last post by:
Hi, Is there any one knows, if I want to use mod_python to handle my html form, I must have a SMTP server on my PC(winxp pro)? Where can I get a free SMTP server? I cann't follow mod_python's...
21
3340
by: Nancy | last post by:
Hi, Guys, Is there any other way to use python or mod_python writing a web page? I mean, not use "form.py/email", no SMTP server. <form action="form.py/email" method="POST"> ... Thanks a lot. ...
2
1073
by: Jeremy | last post by:
I posted a message recently about an SmtpMail issue I was having (SmtpMail causes the server to have a 502 response: Unknown Command 'SATA'). Since then, I have tried 3 different SMTP components,...
2
1302
by: Ajay | last post by:
Hi I am writing an SMTP server in VB.Net using the as Async Socket Server Code in MSDN as the base. My problem is that the port 25 socket Listener just stops accepting connections after 10 to...
34
18140
by: antonyliu2002 | last post by:
I've set up the virtual smtp server on my IIS 5.1 like so: 1. Assign IP address to "All Unassigned", and listen to port 25. 2. Access Connection granted to "127.0.0.1". 3. Relay only allow...
0
6270
by: jlconde | last post by:
I have a classe to send mails. It runs on yahoo well but with hotmail I never receive the mails.I do not receive an error neither. I would need some strange header to make the hotmail like my...
5
5285
by: jimhill10 | last post by:
I have a perl script that creates an email attachment file from POST data on a web page. This works just fine. I want to customize the email body to contain all of the text data from the file...
7
16871
by: mukeshrasm | last post by:
Hi I am no able to send mail and it is giving this error Warning: mail(): SMTP server response: 530 5.7.3 Client was not authenticated in c:\inetpub\wwwroot\eshop\includes\classes\email.php on...
6
5170
by: phpmagesh | last post by:
Hi, I am using mail function in my php page, As soon i update the details, i have to send mail to the customer with the updated details, problem is when i send mail it simple through waring msg...
0
7223
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7319
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7376
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7031
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7485
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5623
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
760
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
412
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.