Hey guys,
this is the first time a try to get help from a forum with alot of experts... But i can't handle the problem alone...
I try to write a program which sends mails from the users computer but over my account to me... so to the same account.. sound weird i know..
First: The provide is using port 587
Seconde: I need to enter the auhorization, but i don't know how.
Here is the code i'm using so far:
Imports
System.Web.MailPublic
Class frmmain Inherits System.Windows.Forms.Form Private Sub frmmain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim oMail As New MailMessage() Me.Show()SmtpMail.SmtpServer =
"smtp.mail.yahoo.de" With oMail.From =
"***deleted***@yahoo.de".To =
"***deleted***@yahoo.de".Subject =
"Test-Nachricht".Body =
"Test mail" End With TrySmtpMail.Send(oMail)
Catch oEx As ExceptionMsgBox(
"Error: " & oEx.Message.ToString, MsgBoxStyle.Critical, "repoter.exe") End Try End SubEnd
Class
I'm not sure if i'm using the right mail setting... It says recommended is system.net.mail
Please help me.. it can't use the server because its using port 587 and i need to enter the pass...
Please enter the missing things in the code

Trying to send a mail via SMTP in VB 2005 - Authorization problem
Chris77
dehoux
FYI: The c# "using" statement is the same as VB.Net's "Imports" statement
Dim
client As New SmtpClient("mail.contoso.com", 587)client.Credentials =
New NetworkCredential("username", "password") Dim msg As New MailMessage("fromAddress@contoso.com", "toAddress@contoso.com")msg.Subject =
"Sending e-mail with System.Net.Mail.SmtpClient"msg.Body =
"This is the body of the e-mail."client.Send(msg)
CodeZero
Here is an some psuedo code of how to use it (in c# - I'll leave the translation to VB.Net to you):
using System.Net;
using System.Net.Mail;
SmtpClient smtpClient= new SmtpClient("mail.contoso.com", 587);
smtpClient.Credentials = new NetworkCredential("UserName","Password");
MailMessage message = new MailMessage(from, to);
message.Subject = "test1";
message.Body = "HiThere";
smtpClient.Send(message);
Hope this helps.
Carlos_Edmundo
Hello
this sample code doesnt work in my program!
i got this error: failure sending mail.
please help me. i need that!
Keith K
Hi,
this sample code doesnt work im my program!
the error is: 'smtpexception was unhandled' and 'failure sending mail.'
but i really need this sample code! plz help me...
thx
mynakedrat
But is not worked for my application and get me this error"
first must check for new mail
CWDavid
Thanks, but it's not really helping.
I got some errors with that. One is: System.Net is a namespace and cannot be used as an expression. I got others too. C# code isn't that far similar to VB.
I tried to modify the code, and at least it really sended a mail.. but this mail never arrived...
Its my first meeting with the .Net VB. I used VB 6 before and its quite easier in some way.. they changed alot...
So i need an example on how to send a mail. On this example i can realize how the new VB is working (that's the way i'm learning it :D).
Thanks
s_lewis00
Thanks alot..
thats working...
Now i can continue working
csiege
It is NOT working. If i understand properly when i use HOST: mail.hotmail.com, RECIPIENT: someone@yahoo.de (host and recipient domain are different) and the SMTP server requires to authenticate sender, this code should help: smtpClient.Credentials = new NetworkCredential("UserName","Password")
But is NOT working! Why I try more different host and recipient domains and each requires standard authorization (username and password like to pop3 servers). Every time error is: ...domain isn’t in my list of allowed rcpthosts (#5.7.1). It seems SmtpClient not uses Credentials.
For what is Net.Mail.SmtpClient good when i can send emails only to my domain (best to myself)