Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Helloo, All

 

I have a problem to send mail. If connection is witout Proxy it works, but When I configure it with Proxy it gives me a Error ; "COULD NOT ACCES 'CDO:MESSAGE' object"

 

please, help me how I can solve it. This is my Code

Public Sub SendEmail(ByVal LevelID As Integer, ByVal PRotsent As Integer)

               Dim msg As New MailMessage
               Dim d1 As DateTime

               Dim ss, ss1 As String

               Dim myIni As iniFile = New iniFile(mFileName)

               myIni.setActiveSection("general")
               ss1 = myIni.getValue("pathNotify")
               msg.From = "Test@yahoo.com"
               msg.To = ss1
               msg.Cc = ""
               msg.Bcc = ""
               msg.Priority = MailPriority.Normal

               msg.Subject = "Result of Patient " & Me.Name & " Level " & LevelID
               msg.Body = " Patient Name : " & Me.Name & Chr(13) & " PersonID  : " & Me.PersonId & Chr(13) & " Level  : " & LevelID & Chr(13) & " Result : " & PRotsent & "%" & Chr(13) & " Date : " & Format(d1.Now, "yyyy\-MM\-dd hh:mm:ss")

               If mProxy = 0 Then
                       Try

                               '  ss = ss1.Substring(ss1.IndexOf("@") + 1)
                               'ss = msg.From.Substring(msg.From.IndexOf("@") + 1)
                               SmtpMail.SmtpServer = "yahoo.com"
                               SmtpMail.Send(msg)

                       Catch ex As HttpException
                               MsgBox(ex.Message)
                       End Try
               End If

               
       End Sub

  • Administrators
Posted

What kind of proxy are you using and where are you telling your code to use it?

If you mean there is a proxy server between yourself and the internet then it depends on the proxy configuration - most proxys will allow HTTP access out to the internet but may not be configured to allow SMTP, which you require.

You may need to speak to your ISP / Administrator / provider to see if the proxy could be reconfigured.

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Posted
What kind of proxy are you using and where are you telling your code to use it?

If you mean there is a proxy server between yourself and the internet then it depends on the proxy configuration - most proxys will allow HTTP access out to the internet but may not be configured to allow SMTP, which you require.

You may need to speak to your ISP / Administrator / provider to see if the proxy could be reconfigured.

 

I means for example when I use InternetOpen function then I use Proxy parameter for InternetOPen function.

 

I have a proxy between Internet and my Pc you are right, I use for internet InternetOpen function, But I am not sure which function I should use for sending mail through PROXY .

 

When I am in worng way, let me correct

 

Thanks,

  • Administrators
Posted

The InternetOpen function wouldn't really help in this case as I don't think you could mix calls to the unmanaged InteretOpen function and then used managed classes to send your e-mail. Also the InternetOpen function would only work with a CERN type proxy (HTTP, FTP and gopher) rather than SMTP.

 

You will probably need the proxy server / firewall / NAT device between you and the internet to be reconfigured to allow SMTP traffic through (port 25 needs to be opened for outbound traffic).

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...