|
Hello,
Thanks for your help. The code i used is below. But I got a warning saying that using system.web.mail is obsolete and system.net.mail is the recommended to be used instead.
Also using the MS Exchange is very slow, i tried to send an e-mail to my hotmail and gmail account it takes more than 10 minutes to get there.
Is there any setting on the microsoft exchange server that need to be set?
Another quick question, is there a way to get the server name and the e-mail account automatically instead of a user inputting in? They can just click the send button.
Many thanks for your time,
Steve
Code for using system.web.mail
<br />
Private Sub btnSendExchangeServer_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSendExchangeServer.Click<br />
Dim mailMsg As New MailMessage()<br />
<br />
mailMsg.To = "steve@clarityform.com"<br />
mailMsg.From = "steve@clarityform.com"<br />
mailMsg.Subject = "2nd Microsoft Exchange Server Mail Test"<br />
mailMsg.Body = "This email came from MS Exchange Server"<br />
<br />
Try<br />
SmtpMail.SmtpServer = "cf01.clarityforms.com"<br />
SmtpMail.Send(mailMsg)<br />
<br />
Catch ex As Net.Mail.SmtpException<br />
MessageBox.Show(ex.Message)<br />
Catch ex As Exception<br />
MessageBox.Show(ex.Message)<br />
End Try<br />
<br />
End Sub<br />
End Class<br />
Code for using gmail smpt server using system.net.mail
<br />
Private Sub btnSendMail_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSendMail.Click<br />
Dim msgTo As New MailAddress("steve@clarityforms.com")<br />
Dim msgFrom As New MailAddress("steve@clarityforms.com")<br />
Dim msgSender As New MailAddress("steve@clarityforms.com")<br />
<br />
Dim mailMsg As New MailMessage()<br />
mailMsg.Sender = msgSender<br />
mailMsg.To.Add(msgTo)<br />
mailMsg.Priority = MailPriority.High<br />
mailMsg.CC.Add("Steve1_rm@yahoo.com")<br />
mailMsg.Subject = "This is a mail test"<br />
mailMsg.Body = "This is the body of the e-mail, Enjoy"<br />
mailMsg.From = msgFrom<br />
<br />
Dim client As New SmtpClient("smtp.gmail.com", 587)<br />
client.Credentials = New System.Net.NetworkCredential("steve1.rm@gmail.com", "1apple2")<br />
client.EnableSsl = True<br />
<br />
Try<br />
client.Send(mailMsg)<br />
Catch ex As SmtpException<br />
MessageBox.Show(ex.Message)<br />
Catch ex As Exception<br />
MessageBox.Show(ex.Message)<br />
End Try<br />
<br />
End Sub<br />
|
|
|
|
|
hi i know to create a database in ms access through vb.net but i want to delete a database through vb.net code
is it possible then how to achieve it
thanks
with regards
Balagurunathan
with regards
Balagurunathan.B
|
|
|
|
|
First I would say that it is a bad practice to create and drop real tables from a program. If you are just creating tables for temporary use that is different. Now that I got that out of the way.
Is it not as simple as saying DROP TABLE TABLENAME ?
CleAkO
"I think you'll be okay here, they have a thin candy shell. 'Surprised you didn't know that." - Tommy Boy "Fill it up again! Fill it up again! Once it hits your lips, it's so good!" - Frank the Tank (Old School)
|
|
|
|
|
CleAkO wrote: First I would say that it is a bad practice to create and drop real tables from a program.
Why?
|
|
|
|
|
Well for most DBs you would need to elevated priviledges in order to drop or add any table other than a #temp table.
CleAkO
"I think you'll be okay here, they have a thin candy shell. 'Surprised you didn't know that." - Tommy Boy "Fill it up again! Fill it up again! Once it hits your lips, it's so good!" - Frank the Tank (Old School)
|
|
|
|
|
CleAkO wrote: Well for most DBs you would need to elevated priviledges in order to drop or add any table other than a #temp table.
Your original statement was more general than that. Assume that the user has the appropriate privileges. Why would it be bad practice to drop tables from a database in a program?
|
|
|
|
|
I thought we established that all user input is evil and by giving the permission to do this it could be taken advantage of, that's all.
CleAkO
"I think you'll be okay here, they have a thin candy shell. 'Surprised you didn't know that." - Tommy Boy "Fill it up again! Fill it up again! Once it hits your lips, it's so good!" - Frank the Tank (Old School)
|
|
|
|
|
CleAkO wrote: I thought we established that all user input is evil and by giving the permission to do this it could be taken advantage of
You can sanitise the data to ensure that necessary tables are not dropped. The table may be dropped as part of a larger overall process and the drop functionality is not initiated by any specific user input.
Good (or best) practice shows ways to do things that that have a higher likelyhood of producing positive results. It does not deny the ability to do anything, it merely suggests better ways of doing things. If you need to drop a table then there are good ways of doing that.
The table name is 128 characters maximum (in SQL Server). If you ensure that all table names are made up of only specific characters (e.g. letters and numbers only) you can remove the possibility of people managing to inject malicious code into the drop statement because you can reject invalid characters. You can also surround your table name in square brackets. You can verify that the table exists prior to issuing the drop by querying the INFORMATION_SCHEMA.TABLES view using a parameterised query.
There are lots of things you can do to ensure that if you do need to drop a table from your application, you do it safely.
|
|
|
|
|
Just DROP the database. However, in order for this to work you need to ensure that no one is already using the database, and that the connection you are using connects to a different database (e.g. Master)
|
|
|
|
|
Sir/Madam
Can i insert the slashes in the textbox (two slashes) for the user to insert the date(day,month,year).
Please help
Thanks and Regards
Pankaj
|
|
|
|
|
Unless something has changed with 2.0, you will have to create a custom control for this. I did something similar but it was kind of ugly by taking 5 textboxes, the 1st, 3rd, and 5th had the appropriate borders blanked out and the 2nd and the 4th contained the slashes then you put them all side by side with no spaces. Then you use an autotab JS function to make it seem as if they are just typing through a mask in the textbox.
It will appear to be a textbox but there has to be a better way.
CleAkO
"I think you'll be okay here, they have a thin candy shell. 'Surprised you didn't know that." - Tommy Boy "Fill it up again! Fill it up again! Once it hits your lips, it's so good!" - Frank the Tank (Old School)
|
|
|
|
|
There is a MaskedTextBox in .Net 2.0 using Visual Studio 2005 that you can use.
|
|
|
|
|
Thank goodness!
CleAkO
"I think you'll be okay here, they have a thin candy shell. 'Surprised you didn't know that." - Tommy Boy "Fill it up again! Fill it up again! Once it hits your lips, it's so good!" - Frank the Tank (Old School)
|
|
|
|
|
if you need those / for date purposes..its easier to declare a date object to collect the information
and asign the input to that variable.. after the variable or object gets the input as string..u format it to represent what u want...
example:
dim TD as Date
TD = textbox1.text
msgbox(TD.tostring("dd/MM/yyyy")
i just use a message box to display the result..but the same applies were ever u use it..
Nab
|
|
|
|
|
Thats true but I think the OP is asking how to display those in the textbox so that someone understands that it is looking for a date.
CleaKO
"I think you'll be okay here, they have a thin candy shell. 'Surprised you didn't know that." - Tommy Boy "Fill it up again! Fill it up again! Once it hits your lips, it's so good!" - Frank the Tank (Old School)
|
|
|
|
|
just use a datetimepicker
Nab
|
|
|
|
|
Sir/Madam,
Can somebody please tell me the meaning of Referential classes and if possible please send the link of code that illustrates the referential classes
Thanks and regards
Pankaj
|
|
|
|
|
Sir/Madam,
I wanted to know the basic meaning of MyBase and one more thing , which is that , I read somewhere MyBase.Finalize Finalize is the destructor , I know but I wanted to know the meaning of MyBase.Finalize.
Please help
Thanks and Regards
Pankaj
|
|
|
|
|
Do you mean myBase[^], or what do you mean?
If MyBase is a class of yours that has a Finalze method, then that method is the finalizer of the class. A finalizer is usually only used as a backup for the Dispose method in a class that implements the IDisposable interface.
(Classes in C++ have destructors, and the same syntax is used for finalizers in C#, but finalizing in .NET works differently from destruction in C++, so I prefer the term finalizer to emphasise the difference).
When an object is about to be garbage collected, and it has a finalizer, the object will instead be placed in a queue of objects to be finalized. A background thread will run the Finalize method of each object in turn, and after that the object can be garbage collected.
---
single minded; short sighted; long gone;
|
|
|
|
|
MyBase refers to the base class that your class inherits from. It's normally used to call methods or set properties, or what have you, that are implemented in the base class.
Public Class MyTextBoxClass
Inherits System.Windows.Forms.TextBox
...
' Sets the location of the top left corner of our TextBox
MyBase.Location = New Point(40,20)
Also, there are no such things as destructors in the .NET Framework. Dispose and Finalize just gives an object it's last chance to clean up any resources it has to before the GC collects the object.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Sir/madam,
I wanted to know the utility of IDispose interface in the code.Can u please explain with the help of an example.
Thanks and Regards
Pankaj
|
|
|
|
|
Here is a discussion I posted last month.
Implementing Implements System.IDisposable[^]
CleAkO
"I think you'll be okay here, they have a thin candy shell. 'Surprised you didn't know that." - Tommy Boy "Fill it up again! Fill it up again! Once it hits your lips, it's so good!" - Frank the Tank (Old School)
|
|
|
|
|
Sir/Madam,
I was trying a compression program in vb.net.I did it well in C++.But it is not getting possible in vb.net.Can somebody please send the code project link that illustrate the utility of single and double link list
Like the node that contains two sub nodes namely left node and right node.
the left node contains the address and right node too contains the address
in vb.net
Thanks and regards
Pankaj
|
|
|
|
|
i want to create dynamic crystal report.
fields of report will be chosen at the runtime.
|
|
|
|
|
How i create plugins to add to windows media center?
|
|
|
|