Need help with sending email...

Hi, i cant seem to get this email code to work... help please

Page 1 of 1

5 Replies - 1045 Views - Last Post: 07 March 2009 - 12:04 AM Rate Topic: -----

#1 Jack Eagles1  Icon User is offline

  • Pugnacious Penguin (inspired by no2pencil)
  • member icon

Reputation: 183
  • View blog
  • Posts: 1,152
  • Joined: 10-December 08

Need help with sending email...

Post icon  Posted 06 March 2009 - 01:52 PM

i dunno why this is making an error:
Here is error: Error sending mail
here is my code
		Dim net As New System.Net.Mail.MailMessage
		mail.From = New MailAddress("hackedcpuwow@googlemail.com", "Mypassword")
		mail.To.Add("mailtome228@googlemail.com")
		mail.Subject = "SentMail"
		mail.Body = "Hi! here is my email"
		mail.IsBodyHtml = False
		smtp.Host = "smtp.gmail.com"
		smtp.Port = 465
		smtp.EnableSsl = True
		smtp.Credentials = Net
		Timer2.Stop()


:D :D :D :D :D :D :D :D :D :D

Is This A Good Question/Topic? 0
  • +

Replies To: Need help with sending email...

#2 coden4fun  Icon User is offline

  • if(coden4fun.NotTired){ ContinueToCode(); }
  • member icon

Reputation: 27
  • View blog
  • Posts: 696
  • Joined: 27-February 09

Re: Need help with sending email...

Posted 06 March 2009 - 02:12 PM

Dim obj As System.Net.Mail.SmtpClient = New System.Net.Mail.SmtpClient
Dim Mailmsg As New System.Net.Mail.MailMessage
Mailmsg.To.Clear()
Mailmsg.To.Add(New System.Net.Mail.MailAddress("To Name <toname@todomain.com>")
Mailmsg.From = New System.Net.Mail.MailAddress("From Name <fromname@yourfromdomain.com>")
Mailmsg.Subject = "(subject text)"
Try
Mailmsg.Body = "(message text here)"
obj.Send(Mailmsg)
Catch ex As Exception
Response.Write("Error: " & ex.ToString())
End Try



link is here VB.Net SmtpClient

Hope this works and Good luck ;)
Was This Post Helpful? 0
  • +
  • -

#3 Jack Eagles1  Icon User is offline

  • Pugnacious Penguin (inspired by no2pencil)
  • member icon

Reputation: 183
  • View blog
  • Posts: 1,152
  • Joined: 10-December 08

Re: Need help with sending email...

Posted 06 March 2009 - 02:59 PM

Sry, i get an error saying SMTP client was undefined :S

i use @googlemail.com for my email
tyvm
Was This Post Helpful? 0
  • +
  • -

#4 Jack Eagles1  Icon User is offline

  • Pugnacious Penguin (inspired by no2pencil)
  • member icon

Reputation: 183
  • View blog
  • Posts: 1,152
  • Joined: 10-December 08

Re: Need help with sending email...

Posted 06 March 2009 - 03:15 PM

Here is my new code which is yeilding the error:
Try
Dim obj As System.Net.Mail.SmtpClient = New System.Net.Mail.SmtpClient
Dim Mailmsg As New System.Net.Mail.MailMessage
Mailmsg.To.Clear()
Mailmsg.To.Add(New System.Net.Mail.MailAddress("mailtome228@googlemail.com"))
Mailmsg.From = New System.Net.Mail.MailAddress("recievemsg@googlemail.com")
Mailmsg.Subject = "Mytitle"
Mailmsg.Body = "MyBody"
obj.Host = "smtp.googlemail.com"
obj.Send(Mailmsg)
Catch ex As Exception
MsgBox("Error: " & ex.ToString)
End Try
Timer3.Stop()
Was This Post Helpful? 0
  • +
  • -

#5 Wrecks  Icon User is offline

  • D.I.C Head

Reputation: 7
  • View blog
  • Posts: 71
  • Joined: 24-February 09

Re: Need help with sending email...

Posted 06 March 2009 - 03:24 PM

View PostJack Eagles1, on 6 Mar, 2009 - 12:52 PM, said:

i dunno why this is making an error:



Try adding this code to your program:
Mailmsg.UseDefaultCredentials = False

This post has been edited by Wrecks: 06 March 2009 - 03:29 PM

Was This Post Helpful? 0
  • +
  • -

#6 narmer93  Icon User is offline

  • D.I.C Regular

Reputation: 8
  • View blog
  • Posts: 317
  • Joined: 13-March 08

Re: Need help with sending email...

Posted 07 March 2009 - 12:04 AM

well if google mail is the same as gmail then this post may be helpful.
and gmail uses the port 587 this may be the problem.good luck

This post has been edited by narmer93: 07 March 2009 - 12:06 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1