Groups | Blog | Home
all groups > dotnet general > may 2005 >

dotnet general : sending emails thro SMTP server



ufraf
5/19/2005 9:08:08 PM
Hey i am a total newbie in .net.I'm working on an assignment to send email to
the adimin id that's my official id (xx.xx@something.com - the code
developers id) when an invalid user trys to login to the application.I have
to connect to my comapy's server to send emails.In the code when i give the
mailserver as local host the message gets stored in my queues folder.If i
giver the ip address of the server i want to connect to server unreachable
error keeps coming.I dont know if it is due to authentication issues or SMTP
configuration or GOD knows what else :( Here's the code:

msgMail.To = "xx.xx@domain.com"
msgMail.From = "yy.yy@domian.com"
msgMail.Subject = "Notification on Invalid User Login into
System"
msgMail.BodyFormat = MailFormat.Html
strBody = "<html><body><b>Invaild User
Login</b></body></html>"
msgMail.Body = strBody
SmtpMail.SmtpServer = "192.168.23.240"
SmtpMail.Send(msgMail)
Response.Write("Email was qued to disk")

error:
Exception Details: System.Runtime.InteropServices.COMException: The
transport failed to connect to the server.

Well anydody out there with a solution coz i'm in a fix i've spent a whole
day trying to fix this and i'm desperate...............
Guido Kraus
5/20/2005 5:36:06 AM
Hi,

try the following lines just before you send your message:

msgMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", 1)

msgMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "myusername")

msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "mypassword")


Contact your mail server administrator to obtain a valid username/password.

Hope that helps,
Guido

[quoted text, click to view]
ufraf
5/29/2005 10:31:02 PM

Hey Guido,
Thanx for replying.Yeah i tried the code u sent but it didn't work.So i have
to get a vaild user id and password from my sys admin guys.
[quoted text, click to view]
AddThis Social Bookmark Button