Hello!

I had problem sending mails through asp.net, even after writing the code.
But after providing the IP address of my pc in the relay option in IIS, the problem finally got solved.


But now the problem is that the same code when I tried to run on a pc which was a local server, I still face the problem.

I write the follwing code
dim mm as new mailmessage
mm.to="rasvinder.soodan@gmail.com"
mm.from="rasvinder.soodan@gmail.com"
mm.subject="hello"
mm.body="hello"
mm.priority=priority.high
smtpmail.smtpserver="theip addrss of the local machine"
smtpmail.send(mm)


The above code runs succesfully on one pc, which is a normal client pc, but when run on a server machine, mail are not sent.

Can u plz help me out?


Thanks

Recommended Answers

All 2 Replies

set smtpClient.host property

write the name of server in smtpClient.host

Hello to you
I'll just give you a sumary of what I did in a very similar scenario.

Dim oMsg As New CDO.Message
        Dim iConfig As CDO.IConfiguration
        Dim oFields As ADODB.Fields
        Dim oField As ADODB.Field


        Dim strEmailAddress As String = "jobstar@yahoo.co.uk"
        Dim strSubject As String = "Request  for missions"
        Dim msgMail As String = "Pls Find below the details. Thank You."

        iConfig = oMsg.Configuration
        oFields = iConfig.Fields
        ' Set configuration.
        'using the local smtp server
        oField = oFields("http://schemas.microsoft.com/cdo/configuration/sendusing")
        oField.Value = 1
        oFields.Update()

        Try

            'message()
            oMsg.TextBody = msgMail
            oMsg.Subject = strSubject

            oMsg.From = "terrastar@comstar.net"
            oMsg.To = strEmailAddress
            oMsg.Send()

        Catch x As Exception
        Finally

        End Try

Then on the server uncheck the 'allow all computers which successfully authenticate to relay regardless of the list above'

This should work. It worked for me. If any problems please get back to me.

Hello!

I had problem sending mails through asp.net, even after writing the code.
But after providing the IP address of my pc in the relay option in IIS, the problem finally got solved.


But now the problem is that the same code when I tried to run on a pc which was a local server, I still face the problem.

I write the follwing code
dim mm as new mailmessage
mm.to="rasvinder.soodan@gmail.com"
mm.from="rasvinder.soodan@gmail.com"
mm.subject="hello"
mm.body="hello"
mm.priority=priority.high
smtpmail.smtpserver="theip addrss of the local machine"
smtpmail.send(mm)


The above code runs succesfully on one pc, which is a normal client pc, but when run on a server machine, mail are not sent.

Can u plz help me out?


Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.