Click here to Skip to main content
16,007,885 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
QuestionSmtpClient not working in Windows Server 2012 R2 Pin
drentsch9-May-16 5:09
drentsch9-May-16 5:09 
Hi,
i wrote a small vb.net console application for sending emails to a gmail-account.
The application works fine on my developement-system ( wondows 10).
When i distribute the application to Windows server 2012 r2 the app did not send the email, the app termine without error but the email was not send.
i try allready to switch firewall off, but without success.
Anybody has a idea what can be wrong?

The code loke like this:

VB.NET
Imports System.IO
Imports System.Net.Mail
Imports System.Net

Sub Main()
Try
Dim loMessage As MailMessage = Nothing
Dim loClient As SmtpClient = Nothing

loClient = New SmtpClient()
loClient.Timeout = 50000
loClient.Host = "smtp.gmail.com"
loClient.Port = 587
loClient.EnableSsl = True
loClient.Credentials = New System.Net.NetworkCredential("test@gmail.com", "xxxxxxxxxx")

loMessage = New MailMessage()
loMessage.IsBodyHtml = True
loMessage.From = New MailAddress("xxxxxx@gmail.com")
loMessage.To.Add(New MailAddress("xxxxxx@bluewin.ch"))
loMessage.Subject = "Betreff"
loMessage.Body = "Test Ihre Daten..."

loClient.Send(loMessage)

Catch ex As Exception
'MsgBox(ex.ToString)
Dim file As System.IO.StreamWriter
file = My.Computer.FileSystem.OpenTextFileWriter("c:\tmp\err.txt", True)
file.WriteLine(ex.ToString)
file.Close()

End Try
End Sub

AnswerRe: SmtpClient not working in Windows Server 2012 R2 Pin
Nathan Minier10-May-16 1:22
professionalNathan Minier10-May-16 1:22 
GeneralRe: SmtpClient not working in Windows Server 2012 R2 Pin
drentsch10-May-16 1:43
drentsch10-May-16 1:43 
Questioncode working on one pc on on another not... Pin
Member 124732905-May-16 22:18
Member 124732905-May-16 22:18 
GeneralRe: code working on one pc on on another not... Pin
Richard MacCutchan5-May-16 23:12
mveRichard MacCutchan5-May-16 23:12 
GeneralRe: code working on one pc on on another not... Pin
Member 124732906-May-16 0:55
Member 124732906-May-16 0:55 
GeneralRe: code working on one pc on on another not... Pin
Richard MacCutchan6-May-16 2:52
mveRichard MacCutchan6-May-16 2:52 
GeneralRe: code working on one pc on on another not... Pin
Member 124732907-May-16 8:07
Member 124732907-May-16 8:07 
GeneralRe: code working on one pc on on another not... Pin
Richard MacCutchan7-May-16 20:40
mveRichard MacCutchan7-May-16 20:40 
GeneralRe: code working on one pc on on another not... Pin
Member 124732908-May-16 5:49
Member 124732908-May-16 5:49 
GeneralRe: code working on one pc on on another not... Pin
Dave Kreskowiak8-May-16 6:55
mveDave Kreskowiak8-May-16 6:55 
GeneralRe: code working on one pc on on another not... Pin
Richard MacCutchan8-May-16 6:57
mveRichard MacCutchan8-May-16 6:57 
AnswerRe: code working on one pc on on another not... Pin
JHizzle11-May-16 0:07
JHizzle11-May-16 0:07 
QuestionOpen database firebird 3 with vb.net Pin
kokyung24-Apr-16 17:17
kokyung24-Apr-16 17:17 
AnswerRe: Open database firebird 3 with vb.net Pin
Pete O'Hanlon24-Apr-16 20:21
mvePete O'Hanlon24-Apr-16 20:21 
GeneralRe: Open database firebird 3 with vb.net Pin
kokyung28-Apr-16 0:03
kokyung28-Apr-16 0:03 
GeneralRe: Open database firebird 3 with vb.net Pin
Sascha Lefèvre28-Apr-16 0:29
professionalSascha Lefèvre28-Apr-16 0:29 
AnswerRe: Open database firebird 3 with vb.net Pin
kokyung28-Apr-16 16:40
kokyung28-Apr-16 16:40 
QuestionHow to secure web application not copy code Pin
Arvind Zamakia14-Apr-16 3:03
Arvind Zamakia14-Apr-16 3:03 
GeneralRe: How to secure web application not copy code Pin
Sascha Lefèvre14-Apr-16 3:18
professionalSascha Lefèvre14-Apr-16 3:18 
GeneralRe: How to secure web application not copy code Pin
Arvind Zamakia14-Apr-16 3:21
Arvind Zamakia14-Apr-16 3:21 
AnswerRe: How to secure web application not copy code Pin
Eddy Vluggen14-Apr-16 3:22
professionalEddy Vluggen14-Apr-16 3:22 
AnswerRe: How to secure web application not copy code Pin
ZurdoDev14-Apr-16 4:05
professionalZurdoDev14-Apr-16 4:05 
QuestionQuery with Garbage Collection Pin
Rahul Hanumant Chavan8-Apr-16 21:50
professionalRahul Hanumant Chavan8-Apr-16 21:50 
AnswerRe: Query with Garbage Collection Pin
Richard MacCutchan8-Apr-16 22:15
mveRichard MacCutchan8-Apr-16 22:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.