0

I create a eml file from MailMessage and SMTPdeliverymethod.specifiedpickupdirectory

But To save it, I need to fill TO and FROM field. But In fact I don't need them. Is It possible to save mailMeassge without them? Or I try to create a new eml file like here

dim sr as new io.streamreader(Path)
dim sw as new streamwriter(io.Path.combine(io.path.getdirectoryname(Path),"modified.eml")
dim line as string= sr.readline
while line <> nothing
   if not line.startswith("X-Sender:") andalso line.startswith("X-Receiver:") Andalso line.startswith("From:") andalso line.startswith("To:") thensw.writeline(line)
   line=sr.readline
end while
sw.flush
sw.close

But my new file isn't full. I lost my attachments and others lines

How can I have an eml file without from and To. When I want to open, I can fill myself. Or About From field : is it possible to say to take default account of outlook, when user click on it?

braX
  • 11,506
  • 5
  • 20
  • 33
YannickIngenierie
  • 602
  • 1
  • 13
  • 37

1 Answers1

0

In fact it's cause by error in while loop in source webSite

while not sr.enfofstream
    dim line as string=sr.readline
    if not ....
end while

It's good now.

YannickIngenierie
  • 602
  • 1
  • 13
  • 37