Send email

G

Guest

I have created a small windows app that gathers some user entered data, then
prints it to a designated printer.
A specific person then collects the prints from the printer and processes
the info contained thereon.
This all happens within an organisation and no external communication is
required whatsoever.
This works quite well, but now I have been asked to have the application
send an email to the nominated person, informing them that there is a
document on the printer to collect.

Well... it all went south from there.

This is what I have done.

Sub MailUser()
Dim obj As System.Web.Mail.SmtpMail
Dim mail As New System.Web.Mail.MailMessage()

With Mail
.To = "(e-mail address removed)"
.From="(e-mail address removed)"
.BodyFormat=MailFormat.Text
.Subject="Subject goes here"
.Body="This is the body of the mail"
End With

obj.SmtpServer="myserver"
obj.Send(Mail)
End Sub

No go - it was generating a CDO message error, looking a little deeper, the
inner exception is

"System.Runtime.InteropServices.COMException (0x80040213): The transport
failed to connect to the server."

I thought it may have been an smtp problem, perhaps I had the syntax of the
server wrong? I have tried every potentially viable variant that I can think
of, such as the IP, the UNC path, the smtp name, the server name etc. Same
result with all.

We are using Exchange 2003 and this mail is purely for a LAN application, no
attachments, no fancy formatting, just a small text mail, easy - or so I
thought.

Any thoughts appreciated.

We have VS .Net 2002 with .NET 1.0 SP3

Regards - Peter
 
C

Cor Ligthert [MVP]

Peter,

In 80% of the situations is this an SMTP mail server problem.

You can use any SMTP mail server that has access to the outer world an can
be used by the program.

In fact is that mostly any SMTP mail server on earth as long as it is as the
sentence above. It has not to be yours although as you do it to much the
admin from that server will probably put you in his firewall.

I hope this helps a little bit.

Cor
 
G

Guest

Thanks Cor,

that certainly confirms the train of thought that I had and I am sure that
your opinion on the matter is worth considerably more than mine. I will keep
trying different things, until I can find something to make a difference -
even a different error would be helpful at this stage.
 
R

Rick Kalifa

I ran into a similar problem using vbscript. I ended up adding the SMTP
service to the OS where the script runs and left out pointing to a different
server. That worked for me in vbscript.

Also, not sure if this pertains, but the exchange server may not have
forwarding turned on.

RK.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top