Overclock.net - Overclocking.net
     
 
Home Gallery Reviews Blogs Register Today's Posts Mark Forums Read Members List


Go Back   Overclock.net - Overclocking.net > Software, Programming and Coding > Coding and Programming > Application Programming

Reply
 
LinkBack Thread Tools
Old 08-26-08   #1 (permalink)
PC Gamer
 
-Darkness-'s Avatar
 
Join Date: Apr 2008
Location: Far, far away.
Posts: 53

Rep: 3 -Darkness- Unknown
Unique Rep: 3
Trader Rating: 0
Unhappy [Question] Vb.net- SMTP email

Quick question:

In vb.net, lets say you have 4 txtboxes...

txtbox 1 and txtbox 2 being a message


BOX
NUMBER NAME TEXT

3 txtfrom Anything

4 txtto My email

5 txtsubject Anything

6 txtmsg textbox1.text and textobx2.text



So how can I send an email to myself (username@gmail.com) and changing the parameters of the FROM, TO , SUBJECT and MESSAGE to the txtboxes?

I tried some tutorials, didn't work.

And every time I type "imports system.web.mail" on top of the pub class it shows an error....

[offtopic]
And yes, I am new to overclock.net....

Impressive traffic on this site

[/offtopic] :P
__________________


Code:
If bored = true then
webbrowser1.browse ("www.overclock.net")
      End If
-Darkness- is offline   Reply With Quote
Old 08-26-08   #2 (permalink)
Programmer
 
amd

Join Date: Jun 2005
Posts: 85

Rep: 2 fentos Unknown
Unique Rep: 2
FAQs Submitted: 1
Trader Rating: 0
Default

I assume you'd need to configure a SMTP server in order to send the emails. I'll look over some of my stuff and hopefully get back to you sometime this week. (If someone doesn't answer before hand) Been busy of late.

EDIT: Okay a google search brought back this. Give it a shot maybe?

PHP Code:
Public Shared Sub SendMail(strFrom as StringstrTo as StringstrCC as String,
  
strSubject as StringstrBody as StringstrAttachments as StringstrSMTPServer as String)

  
send the email
  
Try
    
Dim insMail As New MailMessage()
    
With insMail
      
.From strFrom
      
.To strTo
      
.Subject strSubject
      
.Body strBody
      
.Cc strCC
      
If Not strAttachments.Equals(String.Empty) Then
        Dim strFile 
As String
        Dim strAttach
() As String strAttachments.Split(";")
        For 
Each strFile In strAttach
          
.Attachments.Add(New MailAttachment(strFile.Trim()))
        
Next
      End 
If
    
End With
    
    
If Not strSMTPServer.Equals(String.Empty) Then
      SmtpMail
.SmtpServer strSMTPServer
    End 
If
    
    
SmtpMail.Send(insMail)
          
  Catch 
As Exception
      Console
.WriteLine(e.Message)
  
End Try

End Sub 
__________________
System: System (2007)
CPU
AMD Athlon 64 X2 Dual Core 2600+
Motherboard
MSI
Memory
1 GB

Last edited by fentos : 08-26-08 at 02:56 AM.
fentos is offline   Reply With Quote
Old 08-26-08   #3 (permalink)
PC Gamer
 
-Darkness-'s Avatar
 
Join Date: Apr 2008
Location: Far, far away.
Posts: 53

Rep: 3 -Darkness- Unknown
Unique Rep: 3
Trader Rating: 0
Thumbs up

Thanks Fentos, will put that in and see if it works.

EDIT:

This is for console, isn't it?

And no worries, I found it bro. ^^
Code:



        Dim Form17 As String
        Form17 = "password"

        txtMessage.Text = TextBox1.Text & ":" & TextBox2.Text
        Dim message As System.Net.Mail.MailMessage
        Dim smtp As New System.Net.Mail.SmtpClient("smtp.gmail.com", 587)
        Message = New System.Net.Mail.MailMessage(txtFrom.Text, txtTo.Text, txtSubject.Text, txtMessage.Text)
        smtp.EnableSsl = True
        smtp.Credentials = New System.Net.NetworkCredential("username@gmail.com", Form17)
        smtp.Send(Message)
        Me.Close()
        Form15.Show()
Guess what was the problem....

There was ' in front of each line...

Lol.

Damn comments.
__________________


Code:
If bored = true then
webbrowser1.browse ("www.overclock.net")
      End If

Last edited by -Darkness- : 08-26-08 at 10:30 AM.
-Darkness- is offline   Reply With Quote
Old 08-26-08   #4 (permalink)
PC Gamer
 
-Darkness-'s Avatar
 
Join Date: Apr 2008
Location: Far, far away.
Posts: 53

Rep: 3 -Darkness- Unknown
Unique Rep: 3
Trader Rating: 0
Default

Cant EDIT,

IT DOESNT WORK..

CAN SOMEONE HELP ME OUT PLEASE


Thank you.

Caps ftw
__________________


Code:
If bored = true then
webbrowser1.browse ("www.overclock.net")
      End If
-Darkness- is offline   Reply With Quote
Reply

Tags
vb.net



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



All times are GMT -4. The time now is 03:40 AM.


Overclock.net is a Carbon Neutral Site Creative Commons License Internet Security By ControlScan

Terms of Service / Forum Rules | Privacy Policy | Advertising | Become an Official Vendor
Copyright © 2008 Shogun Interactive Development. Most rights reserved.
Page generated in 0.23208 seconds with 8 queries