A mature software is essential for email support. Users can use Delphi to implement this function by clicking on the link on the program interface, which is very simple to use.
First, add uses Shellapi to the interface part of the program, because this unit encapsulates the API functions we want to use. Then we can write the program. Here is the code of the program:
PRocedure SendMail
var
s String
Begin
s = 'mailto[email protected]'
ShellExecute0 'open' PChars nil nil SW_SHOWNORMAL
end
In this way, performing this process, you can automatically open the email sending program and send an email to [email protected].
In actual use, sometimes you need to send emails to several mailboxes at the same time, just change the value of s.
s = 'mailto[email protected]? [email protected]&[email protected]'
This way you can send emails to several mailboxes at the same time.
If you want to determine the title and text of the email, you can assign a value to s:
s = 'mailto[email protected]? subject=hello&body=Hello'
Pay attention to:
1. There is no need to add quotation marks when assigning values to the title and text.
2. Although many materials say: If the title and text contain spaces, it needs to be converted to %20. However, during the debugging process, the program can run normally even if it does not convert.
This program is run and passed in Windows 2000 Professional, Delphi 5, and MS Outlook EXPress. For more information, please see the Email Security Email Use Basics Email Server Topics, or