allows for more control of the application and is the only way an external application can use Outlook's data without triggering the Outlook Object Schema Wizard.
CDO (Collaboration data object). CDO provides messaging and collaboration capabilities. CDO allows you to assign jobs in a schedule, find contacts, and perform other tricks.
This article mainly discusses using the mailmessage and smtpmail classes in the system. Web. Mail namespace to simply implement the mail sending function.
Procedure andCodeAs follows: (the example is implemented using winform)
1. Add the reference to the project -->. Net --> Find system. Web. dll, OK, and add it.
2. Add the using code:UsingSystem. Web. mail;
3. Write the core sending code: Private Void Sendmail ( String Server, String From, String To, String Subject, String
asp.net can find a file named Cdosys.dll in the System32 subdirectory of the system directory (such as C:\Winnt or C:\Windows), and we can call this COM component through ASP.net to send the email. CDOSYS is built on top of the SMTP protocol and NNTP protocol and is installed as a component of Windows2000 server. Of course, we can also use Exchange2000 Cdoex.dll to implement the mechanism of sending mail, because Cdosys.dll embedded into the operating system, so no longer to register the corresp
In the development of e-mail sender, we often need to use the corresponding components, in fact, do not need third-party components (for example: JMail) as usual can send email functions.A file named Cdosys.dll can be found in the System32 subdirectory of the system directory (such as C:/winnt or c:/windows), and we can call this COM component via ASP to implement email delivery. CDOSYS is built on top of the SMTP protocol and the NNTP protocol and is installed as a component of Windows2000 serv
Send mail with CDONTS two functions, very good, fast record down!
--------------------------------------------------------------------------------
Freezwy in 2001-6-29 11:47:02 and posted in Joy asp← return page
Sub SendMail (Fromwho,towho,subject,body)
Dim CDO
Set Cdo=server.createobject ("Cdonts.newmail")
Cdos. From=fromwho
Cdos. to = towho
Cdos. Subject =subject
Cdos. Body =body
Cdos. Mailformat=0
' Desc
There are required demos for send a email with C sharp language. However, you will find that most of them will be failed because of smtpserver. Especially, authorization is required.
Public void sendemail ()
...{
Mailmessage mail = new mailmessage ();
Mail. Priority = mailpriority. High;
Mail. From = "cccc@gmail.com ";
Mail. To = "cccc@163.com ";
Mail. Subject = "Send email system Demo ";
Mail. Body = "just for test .";
Mail. bodyencoding = encoding. utf8;
// Authorization
Mail. Fields. Add ("h
follows:
Create procedure sys_sendmail @ To varchar (100), @ Bcc varchar (500), @ Subject varchar (400) = "",
@ Body varchar (4000) = ""
AS
Declare @ smtpserver varchar (50) -- SMTP server address
Declare @ smtpusername varchar (50) -- SMTP server user name
Declare @ smtpuserpassWord varchar (50) -- SMTP server password
Set @ smtpserver = 'smtp .163.com'
Set @ smtpusername = 'yourname @ 163.com '-- set this parameter to your 163 email user name.
Set @ smtpuserpassword = 'Password' -- set it to
. Body = message;
Em. attachments. Add (New mailattachment ("FILENAME "));
// Found out how to send authenticated email via system. Web. Mail at http://SystemWebMail.com (fact 3.8)
If (this. Username! = NULL this. Password! = NULL)
{
Em. Fields. Add ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1"); // Basic Authentication
Em. Fields. Add ("http://schemas.microsoft.com/cdo/configurat
90% exchange mail management developed using WebDAV (5)
-- The remaining 10% is used for sending emails.
In the above article, I know the basic format of the mail, but I still have no way to use WebDAV to construct an email with an attachment. Although the basic idea is as follows: UseCodeGenerate randomBoundaryString, and then convert the uploaded file to base64 encoding, and attach it to the email. However, the attempt was unsuccessful. Later, I found on a blog that I needed to construct a
Send mail
method One: Use the System.Web.Mail namespace (this method I test did not succeed)
Copy Code code as follows:
#region Send message: This method fails
protected void sendfailed ()
{
System.Web.Mail.MailMessage Mail = new System.Web.Mail.MailMessage ();
Mail. from = "test@ gmail.com";
Mail. to = "test@ gmail.com";
Mail. Subject = "for Test";
Mail. Priority = System.Web.Mail.MailPriority.Normal;
Mail. bodyencoding = Encoding.default;
Mail. BodyFormat = mailformat.html
stored procedures are as follows:
CREATE PROCEDURE sys_sendmail @To varchar (m), @Bcc varchar (+), @Subject varchar (400) = "",
@Body varchar (4000) = ""
As
Declare @smtpserver varchar--SMTP server address
Declare @smtpusername varchar--SMTP Server user name
Declare @smtpuserpassWord varchar--SMTP server password
Set @smtpserver = ' smtp.163.com '
Set @smtpusername = ' yourname@163.com '--set to your 163 mailbox username
Set @smtpuserpassword = ' Password '--this is set to your 163-mai
Using the Cdo.message object can be implemented, the sample code demonstrates that Gmail sent plain text and with the attachment of the mail, as for other e-mail, need to modify the corresponding SMTP server and port in the code, the principle is the same, no example. Posted code does not write comments, you need to see the comments download source.
Copy Code code as follows:
Const email_from = "still.demon@gmail.com"
Const Password = "Password"
Const email_to = "380401911@qq
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.