|
|
i am new to vb.net.
i would like to create a class for sending emial . i tried the script online but i failed to send.
So i got this code below from the hosting server.
May i know how do i simplify the below script to just receive
FromEmail, Subject, Message ?
why it needs the mailerpath?mailerport? and errText? isn't we can check those error in the form instead of class ?
Please kindly advice. thanks
' **** MailerPath = Your SMTP path (for eg: mail.[domain].com) ***
function CDOSYS_Mailer(Message, FromEmail, ToEmail, FromName, ToName, Subject, MailerPath, MailerPort, errText, searchURL)
on error resume next
dim Mailer
set Mailer = server.createobject("CDO.Message")
if err.number <> 0 then
errText = displayError("CDOSYS", searchURL, err.Number, err.Source, err.Description)
CDOSYS_Mailer = false : set Mailer = nothing : err.clear() : err = 0
exit function
end if
Mailer.From = FromName & " <" & FromEmail & ">"
Mailer.To = ToName & " <" & ToEmail & ">"
Mailer.TextBody = Message
Mailer.Subject = Subject
with Mailer.Configuration
.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = MailerPath
.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = MailerPort
.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate")=1
.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername")="test@yourdomain.com"
.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword")="youremailpassword"
.Fields.Update
end with
Mailer.Send
if err.number <> 0 then
errText = displayError("CDOSYS", searchURL, err.Number, err.Source, err.Description)
CDOSYS_Mailer = false : set Mailer = nothing : err.clear() : err = 0
exit function
end if
set Mailer = Nothing
CDOSYS_Mailer = true
end function
|
|
|
|
|
your posts have an edit button and a delete button. Please, please, ask your questions once only. Edit them if you need to change them, don't repost.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Hello;
This seems to rather be VBScript and not VB.Net - which do you require help with?
VB.Net:
Public Shared Sub SendMail(ByVal mailTo As MailAddressCollection, ByVal mailFrom As String, _
ByVal mailSubject As String, ByVal mailPriority As System.Net.Mail.MailPriority, _
ByVal isHtmlFormat As Boolean, ByVal mailBody As String, _
Optional ByVal mailCC As MailAddressCollection = Nothing, _
Optional ByVal mailBcc As MailAddressCollection = Nothing, _
Optional ByVal mailFromDisplayName As String = Nothing)
Dim msg As New System.Net.Mail.MailMessage
For Each m As MailAddress In mailTo
msg.To.Add(m)
Next
If mailFromDisplayName Is Nothing Then
msg.From = New MailAddress(mailFrom)
Else
msg.From = New MailAddress(mailFrom, mailFromDisplayName)
End If
msg.Subject = mailSubject
msg.Priority = mailPriority
msg.IsBodyHtml = isHtmlFormat
If Not mailCC Is Nothing Then
For Each m As MailAddress In mailCC
msg.CC.Add(m)
Next
End If
If Not mailBcc Is Nothing Then
For Each m As MailAddress In mailBcc
msg.Bcc.Add(m)
Next
End If
msg.Body = mailBody
Dim smtpServer As New System.Net.Mail.SmtpClient()
smtpServer.Port = 25
smtpServer.Host = Convert.ToString(ConfigurationManager.AppSettings("SiteSMTP"))
Try
smtpServer.Send(msg)
Catch ex As Exception
Throw New Exception(String.Format("An error occurred sending an e-mail. The error recorded was {0}", ex))
End Try
End Sub
|
|
|
|
|
Hello,
How can I enable and disable modem via code?
Thanks
|
|
|
|
|
|
I recommend you start by reading the guide on how to ask questions. How does 'help me' make sense as a subject ? Everyone here wants help.
What is a bamp project and what is a glb file ? In what capacity do you want to add them ? Even if I knew what they were, I'm not sure I could answer you, because you are not clear on what you want.
According to the urban dictionary, a bamp is a person of low intellect. I'm sure this is not what you mean, so please explain yourself.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Hi,
I don have a code to open an existing excel spreadsheet.The Excel is in C: Drive.AM using the language as VB. Can anyone help me out???.
Thanks in advance
With Regards,
Samson
|
|
|
|
|
You are a glutton for punishment aren't you. In the last 20 minutes you could have searched and copy/pasted this solution many times over.
Now you want to spam the site. God I hope I'm not feeding a troll!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Have you tried just launching the .XLS files using Process.Start ??
|
|
|
|
|
Or have you tried saving the excel file as a csv file, then parsing its contents into the DataGridView control? (Using the Split could be a start)
Lloyd J. Atkinson
|
|
|
|
|
Hi..
Entry Level Prog in .net...
Now im doing project in billing software..
i want to secure my project..
i got USB id and Cpu id from client machine..
when i insert my USB(Pen drive) in my client..
At the time CPU id ill be "insert into USB permanently"...
i need solution for how to insert some datas or cpu id in usb....
Once insert key doesnt change when insert another system.. so easily protect my project....
Thx in Advance
By
Kannan.c
|
|
|
|
|
All you can do is to create a file on the stick and read/write the file. Hardly secure. There are hardware solutions out there that will do this, and without a file, but they are rather expensive.
|
|
|
|
|
Hi,
seems like most if not all USB memory sticks contain a unique ID, which you can obtain using WMI and Win32_DiskDrive (even as a regular user on Vista, as opposed to a hard disk's serial number). So I see two possible schemes where your software only runs with the stick present:
1.
have the USB serial number hardcoded in your app; have it contain code to retrieve and compare the serial number, and exit when no match is found.
Pro: simple
Con: the exe needs personalization
2.
instead of hardcoding it, have it stored in an encrypted way in a license file somewhere (could even be on the USB stick, does not matter); now have your app retrieve the hardware's serial number, and retrieve and decrypt the file, and compare both.
Pro: all customers can use the same exe
Con: you somehow must create and deliver the license files to your customers
Remark: for .NET apps, you still need some obfuscation, otherwise it is rather easy to patch a new serial number in there, and/or reverse engineer the encryption/decryption stuff.
|
|
|
|
|
Hi.. thx for reply..
i got USB unique id and cpu id.. But i need only how to send datas(CPU id) into USB....
|
|
|
|
|
You don't send data "into USB". You talk to the device attached to it directly.
|
|
|
|
|
|
You buy a book, you work through the book and learn how to code. You then get another book on application design and read and understand that.
In a couple of weeks when you have a coding problem and have learnt enough not to ask silly questions you come back and we will help you learn.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
ok...
it looks silly to u but i don have time,,,
i can do it with simple database but i want to know how to do it with sqlmembershipprovider????
thanx
|
|
|
|
|
code_collector wrote: but i don have time
So... it's urgent? Why didn't you tell?
|
|
|
|
|
If this is homework ask your teacher. If this is paid work, admit to the person paying that you're ripping them off. If this is for fun, choose something simpler and work up to this.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Well said.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
The following will hide a form in a nice fading fasion (like Vista)
Private Const AW_BLEND = &H80000 'Uses a fade effect. This flag can be used only if hwnd is a top-level window.
Private Declare Function AnimateWindow Lib "user32" (ByVal hwnd As Int32, ByVal dwTime As Int32, ByVal dwFlags As Int32) As Boolean
Dim winHide As Integer = &H10000
Dim winBlend As Integer = &H80000
.........
.........
AnimateWindow(Me.Handle.ToInt32, CInt(1500), winHide Or winBlend) ' use in place of me.hide
Does anyone know how to have a form fade into view?
|
|
|
|
|
Me.Opacity ? You could then use a timer control to increment its value.
Lloyd J. Atkinson
|
|
|
|
|
The same function, AnimateWindow will fade a window into view as well.
Just remove the "winHide" constant from your function call, and it will assume you are trying to SHOW the window instead of HIDE it.
Please read the following function documentation from MSDN:
AnimateWindow Function
--------------------------------------------------------------------------------
The AnimateWindow function enables you to produce special effects when showing or hiding windows. There are four types of animation: roll, slide, collapse or expand, and alpha-blended fade.
Syntax
BOOL AnimateWindow( HWND hwnd,
DWORD dwTime,
DWORD dwFlags
);
Parameters
hwnd
[in] Handle to the window to animate. The calling thread must own this window.
dwTime
[in] Specifies how long it takes to play the animation, in milliseconds. Typically, an animation takes 200 milliseconds to play.
dwFlags
[in] Specifies the type of animation. This parameter can be one or more of the following values. Note that, by default, these flags take effect when showing a window. To take effect when hiding a window, use AW_HIDE and a logical OR operator with the appropriate flags.
AW_SLIDE
Uses slide animation. By default, roll animation is used. This flag is ignored when used with AW_CENTER.
AW_ACTIVATE
Activates the window. Do not use this value with AW_HIDE.
AW_BLEND
Uses a fade effect. This flag can be used only if hwnd is a top-level window.
AW_HIDE
Hides the window. By default, the window is shown.
AW_CENTER
Makes the window appear to collapse inward if AW_HIDE is used or expand outward if the AW_HIDE is not used. The various direction flags have no effect.
AW_HOR_POSITIVE
Animates the window from left to right. This flag can be used with roll or slide animation. It is ignored when used with AW_CENTER or AW_BLEND.
AW_HOR_NEGATIVE
Animates the window from right to left. This flag can be used with roll or slide animation. It is ignored when used with AW_CENTER or AW_BLEND.
AW_VER_POSITIVE
Animates the window from top to bottom. This flag can be used with roll or slide animation. It is ignored when used with AW_CENTER or AW_BLEND.
AW_VER_NEGATIVE
Animates the window from bottom to top. This flag can be used with roll or slide animation. It is ignored when used with AW_CENTER or AW_BLEND.
Return Value
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. The function will fail in the following situations:
If the window uses the window region. Windows XP: This does not cause the function to fail.
If the window is already visible and you are trying to show the window.
If the window is already hidden and you are trying to hide the window.
If there is no direction specified for the slide or roll animation.
When trying to animate a child window with AW_BLEND.
If the thread does not own the window. Note that, in this case, AnimateWindow fails but GetLastError returns ERROR_SUCCESS.
To get extended error information, call the GetLastError function.
Remarks
To show or hide a window without special effects, use ShowWindow.
When using slide or roll animation, you must specify the direction. It can be either AW_HOR_POSITIVE, AW_HOR_NEGATIVE, AW_VER_POSITIVE, or AW_VER_NEGATIVE.
You can combine AW_HOR_POSITIVE or AW_HOR_NEGATIVE with AW_VER_POSITIVE or AW_VER_NEGATIVE to animate a window diagonally.
The window procedures for the window and its child windows should handle any WM_PRINT or WM_PRINTCLIENT messages. Dialog boxes, controls, and common controls already handle WM_PRINTCLIENT. The default window procedure already handles WM_PRINT.
If a child window is displayed partially clipped, when it is animated it will have holes where it is clipped.
AnimateWindow supports RTL windows.
Avoid animating a window that has a drop shadow because it produces visually distracting, jerky animations.
|
|
|
|
|