Email
Email
Email
Email
Email
Email Email Email Email Email Email Email Email
Email Email
Email
Go Back  Xtreme Visual Basic Talk > > > Email


Reply
 
Thread Tools Display Modes
  #1  
Old 05-27-2009, 08:54 AM
usetheforce2's Avatar
usetheforce2Email usetheforce2 is offline
Senior Contributor

Retired Moderator
* Expert *
 
Join Date: Jul 2000
Location: Toronto, Ontario, Canada
Posts: 1,410
Default Email


hey folks, i'm using the following code to send simple SMTP mail. the code sends successfully on the development PC however, as soon as i move this to another environment (another PC) the message delivery fails..

observations:
>> locally i'm using a version of .Net (2.0.50727) (under application properties > references)
>> the remote machines for which this is failing on has various version of .net 1, 2, 3
>> i'm using the VS2005 and publishing with the wizard
>> used a packet sniffer to monitor the network interface connected to the network and the no traffic is being generated by the source/sending pc.



Imports System.Net
Imports System.Net.Mail
Code:
    Public Sub SendEmail(ByVal Email_To As String, _
                         ByVal Email_CC As String, _
                         ByVal Email_From As String, _
                         ByVal Subject As String, _
                         ByVal Data As String, _
                         ByVal Server As String, _
                         ByVal Server_Port As Long, _
                         Optional ByVal User As String = "", _
                         Optional ByVal Password As String = "")

        Dim Message As New MailMessage()
        Dim client As New SmtpClient(Server, Server_Port)
        Dim SMTPUserInfo As New NetworkCredential(User, _
                                                  Password, _
                                                  Server)

        client.UseDefaultCredentials = False

        client.Credentials = SMTPUserInfo

        Message.From = New MailAddress(Email_From.Trim)

        Message.To.Add(New MailAddress(Email_To))

        Message.Subject = "[" & Subject & "]"

        Message.Body = Data

        MsgBox("Email Details..." & vbNewLine & "To: " & Message.To.ToString & _
                        vbNewLine & "FROM: " & Message.From.ToString & _
                        vbNewLine & "SUBJECT: " & Message.Subject.ToString & _
                        vbNewLine & "BODY: " & Message.Body.ToString)
        Try
            client.Send(Message)
            MsgBox("Mail Sent Successfully!!")
        Catch ex As Exception
            MsgBox("Exception in SendEmail: " & ex.Message & vbNewLine & "Mail delivery failure!!")
        End Try
    End Sub
__________________
winsock siteHERE||EliteVBHERE||C++ & VB Markup UtilityHERE
Reply With Quote
  #2  
Old 06-02-2009, 10:58 AM
AgentSmithers AgentSmithers is offline
Contributor
 
Join Date: Jan 2005
Location: SOCal
Posts: 492
Default

Check Firewall, Theirs nothing Static in that code to go off of to that tell me 100% reason why changing computers would not connect, Possibly be a different story if the executable would not run at all, but as for not connecting, Check your firewall.
__________________
Http://ControllingTheInter.Net
My General Computer Forum, From Security To Programming And Back To Troubleshooting.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Email
Email
Email Email
Email
Email
Email Email Email Email Email Email Email
Email
Email
 
Email
Email
 
-->