![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#11 |
|
Hobbyist Programmer
|
I just have to be an ass and say "A bit" I think that's an under statement. Google SMTP server or go to download.com and search for SMTP server. Or if you have windows xp pro, or server, install IIS, and there is a default smtp server in there. Once you have an SMTP server, you will want to then learn how to configure it
|
|
|
|
|
|
#12 |
|
Programmer
Join Date: Oct 2005
Posts: 52
Rep Power: 3
![]() |
Wow alot of posts to original quesiton thanks everyone! I figured as much as was posted just wanted a second opinion. As for mattireland asking here is what I have so far (keep in mind that I threw this together in under 10 mins so the code works but isn't secure in anyway:
Dim obj As System.Net.Mail.SmtpClient
Dim smtpServer As String = "mail.optonline.net"
Dim Mm As System.Net.Mail.MailMessage
Dim recip As System.Net.Mail.MailAddress
Dim sender As System.Net.Mail.MailAddress
Private Sub btnSend_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSend.Click
obj = New System.Net.Mail.SmtpClient
obj.Host() = smtpServer
obj.Port() = 25
obj.EnableSsl = False
If txtTo.Text = "" Then
MsgBox("You must enter a recipient", MsgBoxStyle.Exclamation, "Error")
End If
If txtFrom.Text = "" Then
MsgBox("You must enter a sender", MsgBoxStyle.Exclamation, "Error")
End If
If txtSubject.Text = "" Then
MsgBox("You must enter a subject", MsgBoxStyle.Exclamation, "Error")
End If
recip = New System.Net.Mail.MailAddress(txtTo.Text)
sender = New System.Net.Mail.MailAddress(txtFrom.Text)
Mm = New System.Net.Mail.MailMessage(sender, recip)
Mm.Subject() = txtSubject.Text
Mm.Body = txtBody.Text
Try
obj.Send(Mm)
MsgBox("Mail successful!", MsgBoxStyle.Exclamation, "Success")
Catch ex As Exception
MsgBox("The mail service could not be reached", MsgBoxStyle.Critical, "Bad Connection")
End Try
End SubAgain not the best code but still it works. Also you don't have anything wrong with your code except what everyone else said that you aren't running a mail server and you should smtp if you want to work with mail (highly important). Anyone feel free to comment/critique my code... |
|
|
|
|
|
#13 |
|
Programmer
Join Date: Oct 2005
Posts: 52
Rep Power: 3
![]() |
On a similar note I've done some extensive searching for ways to implement a receive feature for e-mail but none of them seem to be clean cut. Anyone have any suggestions on which way to go with receiving mail?
|
|
|
|
|
|
#14 |
|
Hobbyist Programmer
|
looking at that code, it appears to be much better in the way that you are using the objects.
|
|
|
|
|
|
#15 |
|
Hobbyist Programmer
|
Could you elaborate on why you think the code would appear to be 'better' because of 'the way' he is using objects? - I cant understand why you would think so.
__________________
Mona Lisa must of had the highway blues you can tell by the way she smiles.. |
|
|
|
|
|
#16 |
|
Hobbyist Programmer
|
Thanks for all the responses guys - especially NightShade01 - definitely thanks! I'll give it a go in a few mins. Thanks again!
|
|
|
|
|
|
#17 |
|
Hobbyist Programmer
|
Thanks again for posting your code. I've sort of mucked around with it a bit but it's still not working. Can anyone lend me a hand?:
Dim txtTo = "matt@mattireland.co.uk"
Dim txtFrom = "matt@mattireland.co.uk"
Dim txtSubject = "Hello"
Dim txtBody = "Test"
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim obj As System.Net.Mail.SmtpClient
Dim smtpServer As String = "mail.optonline.net"
Dim recip As System.Net.Mail.MailAddress
Dim sender1 As System.Net.Mail.MailAddress
obj = New System.Net.Mail.SmtpClient
obj.Host() = smtpServer
obj.Port() = 25
obj.EnableSsl = False
If txtTo = "" Then
MsgBox("You must enter a recipient", MsgBoxStyle.Exclamation, "Error")
End If
If txtFrom = "" Then
MsgBox("You must enter a sender", MsgBoxStyle.Exclamation, "Error")
End If
If txtSubject = "" Then
MsgBox("You must enter a subject", MsgBoxStyle.Exclamation, "Error")
End If
recip = New System.Net.Mail.MailAddress(txtTo)
sender1 = New System.Net.Mail.MailAddress(txtFrom)
Dim Mm5 As New System.Net.Mail.MailMessage(sender1, recip)
Mm5.Subject() = txtSubject
Mm5.Body = txtBody
Try
obj.Send(Mm5)
MsgBox("Mail successful!", MsgBoxStyle.Exclamation, "Success")
Catch ex As Exception
MsgBox("The mail service could not be reached", MsgBoxStyle.Critical, "Bad Connection")
End Try
End SubJust back onto the SMTP server: I do I configure the built in one in xp pro??? Thanks! |
|
|
|
|
|
#18 |
|
Programmer
Join Date: Apr 2005
Posts: 32
Rep Power: 0
![]() |
Sending emails from ASP.Net page
Hi,
string sURL, sFullURL, sBody, URLText; sURL = "http://www.jobssite.com/sitejob/ractken.aspx"; sFullURL = sURL + "?Code=" + sCode; URLText = "Jobsken Site"; String displayResult = "Go to <A HREF=" + sFullURL + " >" + URLText + "</A>"; Response.Write(displayResult); String strHTMLBody; strHTMLBody = "<html><head><title>Confirm your registration.</title></head><body>Congratulations ! You have successfully completed registration.<br /><br />Now you need to confirm your registration.<br /><br />To confirm your registration, click on the link : <A HREF=" + sFullURL + " >" + URLText + "</A><br /><br />Regards,<br />From the team at Jobs.</body></html> "; MailMessage oMessage = new MailMessage(); oMessage.Subject = "Confirm your registration. Jobs"; oMessage.Body = strHTMLBody; oMessage.IsBodyHtml = true; oMessage.From = new MailAddress("job@jobs.com"); oMessage.To.Add(new MailAddress(txtEmail.Text)); oMessage.Priority = MailPriority.High; SmtpClient client = new SmtpClient("smtp.XXXXXX.com"); client.UseDefaultCredentials = true; client.Send(oMessage); Database programming using Visual Basic 2005 |
|
|
|
|
|
#19 |
|
Caffeinated Neural Net
![]() Join Date: Jun 2005
Location: Dry west coast of Canada
Posts: 1,009
Rep Power: 5
![]() |
@Bharathi: You've been a member of the forums for over two years, but you still haven't figured out [code] tags?
__________________
And once again, Probability proves itself willing to sneak into a back alley and service Drama as would a copper-piece harlot. - Vaarsuvius, Order of the Stick |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Language display in program | Prm753 | C++ | 3 | May 30th, 2006 5:45 PM |
| Help me program this with Watcom! | DBZ | Other Programming Languages | 3 | Feb 26th, 2006 9:41 PM |
| Creating a program to test a program | sixstringartist | C | 8 | Jan 21st, 2006 1:15 PM |
| move program console window back | badbasser98 | C++ | 21 | Oct 18th, 2005 2:02 PM |
| airport Log program using 3D linked List : problem reading from file | gemini_shooter | C++ | 0 | Mar 2nd, 2005 4:12 PM |