Hack Forums
[.NET] Need Help On Email Sender Code Error :( - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [.NET] Need Help On Email Sender Code Error :( (/showthread.php?tid=4556295)



Need Help On Email Sender Code Error :( - Teruz14 - Nov 26, 2014

Hello hackforums ✌

I'm trying to make a email sender for people that need help can send me a quick email

This is how the project looks

[Image: uX7vBSR]

- https://imgur.com/uX7vBSR

This is my code :

Quote: Imports System.Net.Mail

Public Class Sendemail

Private Sub Button1_Click( sender As Object, e As EventArgs) Handles Button1.Click
Dim Mail As New MailMessage
Mail.Subject = "[email protected]"
Mail.To.Add(TextBox2.Text)
Mail.From = New MailAddress (TextBox2.Text)
Mail.Body = TextBox1.Text

Dim SMTP As New SmtpClient ("smtp.gmail.com")
SMTP.EnableSsl = True
SMTP.Credentials = New System.Net.NetworkCredential (TextBox2.Text, TextBox3.Text)
SMTP.Port = 587
SMTP.Send(Mail)
Me.Close()
End Sub
End Class


I don't know what im doing wrong when i try send a email it gives me this error

[Image: tyAYKsL]

- https://imgur.com/tyAYKsL


* - Dialog - Nov 26, 2014

Change the port to 465, as you're using SSL rather than TLS.


* - Bogz Binnie - Nov 26, 2014

Well i have something simillar to this but it is set to my timer1 i see you have this code bound to your button 1 What you have to do is copy and paste this code i put into your timer1

Quote:Dim mymailmessage As New MailMessage
mymailmessage.From = New MailAddress(TextBox1.Text)
mymailmessage.To.Add(TextBox5.Text)
mymailmessage.Subject = (TextBox4.Text)
mymailmessage.Body = (TextBox3.Text)
Try
Dim smtpserver As New SmtpClient("Smtp.Gmail.com")
smtpserver.Port = 587
smtpserver.Credentials = New System.Net.NetworkCredential(TextBox1.Text, TextBox2.Text)
smtpserver.EnableSsl = True
smtpserver.Send(mymailmessage)
Catch ex As Exception
End Try
End Sub


Replace the textboxes that i have with the ones that you use (i might have textbox5.text when you use textbox3.text)

Then for your button1 you put timer1.start

I copied that code straight from my spammer, so I hope i helped you out. Like i said that dim mailmessage stuff has to go into your timer not the button. If you need any more help i may be able to help you via skype if you need it. For now, good luck.


* - He B TeMy - Nov 27, 2014

The error is explicit, the server could not authenticate you.

One of two happened:

You set the credentials wrong.
Or the account doesn't allow "insecure apps" https://www.google.com/settings/security/lesssecureapps

Edit: Your code works with me.