ScenarioMany websites require people to register before accessing the content or making comments. How can a website such as Niu Mao make people remember every website they have registered. During the registration process, you can send an email to remind users that they have just registered. In this way, they may return to your website later.
Solution
After the user registers, use smtpclient and mailmessage to send email notifications.
Discussion
. Subject = "this is a test email"; // mail title
MSG. subjectencoding = system. Text. encoding. utf8; // email title Encoding
MSG. Body = "Mail content"; // mail content
MSG. bodyencoding = system. Text. encoding. utf8; // email Content Encoding
MSG. isbodyhtml = false; // whether the email is an HTML email.
MSG. Priority = mailpriority. High; // mail priority
Smtpcli
In the past two days, you need to create a webpage that collects information submitted by users and then sends an email to the specified email address. You can use the class below system. net. Mail to send emails in Asp.net 2.0. The http://www.systemnetmail.com/faq/2.1.aspx address is written by the author of system. net. Mail as if it is similar to msdn FAQ, seeCodeYou can refer to the following. Don't talk about anything. paste the code below. After all, the Code is the most important:
1
P
, select Properties
Change DisplayName, ServiceName for Seramailservice
Startup type is auto start
Right-ServiceProcessInstaller1, then select Properties change user to LocalSystem Right-Service1.cs design file, select View Code In the OnStart method, enter the following code:
The code is as follows
Copy Code
public void Getmail (object sender, System.Timers.ElapsedEventArgs args){NetworkCredential cred = new NetworkCredential ("email@lafarge.com", "Pas
This article takes 163 mailboxes as an example, describes how to send messages using PowerShell, the following is the script content.# Restore PowerShell's default execution policy, which does not allow any scripts to be executed by default# Set-executionpolicy Default-force#设置Powershell的执行策略为, you can execute any script# Set-executionpolicy Unrestricted-force#定义一个发送邮件的函数sendEmail (recipient address, sender address, mail server, mail server port, mail server login password, mail header, message
VS2005 (asp.net2.0) easy to send mail.
In asp.net 2.0 it is easy to develop SMTP email messages. Unlike an ASP, you have to register JMail controls or something.
You need to reference the following namespaces:Using System.Net.Mail;Using System.Net;
The following is a message sent via smtp.126.com. Smtp.126.com requires authentication.protected void Sendmail_click (object sender, EventArgs e){String to = "xpnew@126.com";String from = "xpnew@126.com";String subject = mailtitle.text;//"Using the ne
); // capture the file and store it in the memory.
Attachment MA = new attachment (M, strfilename );
Mail. attachments. Add (MA );
}
// Set verification information
Smtpclient SMTP = new smtpclient ("MailServer ");
SMTP. Credentials = new networkcredential ("username", "password"); // SMTP Verification
SMTP. Send (Mail );
Mail. attachments. Dispose (); // After the email is sent, the attachment is locked.
S
In DOTNET, smtpclient is used to send emails. Previously, system. Web. Mail was not recommended. The new method is in the namespace system. net. Mail.
The following namespaces are involved:
Using system. net. mail;Using system. net;Using system. net. Mime;
Here are two simple examples:
// Synchronously send the smtpclient client = new smtpclient (); // SMTP serv
each mail I want to achieve, and it is not suitable for searching some of the content on the Internet, finally, I decided to modify jmail by myself.. net.
Download to a decompilation source code of jmail. Net (if you need to search for the source code by yourself, we will not provide it here), load vs2005, and start to read the code.
The automatic prompt during code writing shows that the sent code is sent by dimac. jmail. SMTP. send () to directly view dimac. jmail. SMTP. CS code. Locate the m
Topics
Many websites require users to register or log on when accessing content or posting comments. As there are more and more such websites, it is very difficult for users to remember the sites and information they have registered. When a user submits the registration information, the website can send an email reminding the user that they have just signed the registration information so that they can query it later.
Solution
Implement the smtpclie
UsingSystem. Collections. Generic;
UsingSystem. text;
UsingSystem. net;
UsingSystem. net. mail;Try
{
// The code must be gb2312.
Encoding encoding = encoding. getencoding (936 );
Mailmessage message =NewMailmessage (
New mailaddress (" your mailbox ", " 5 ", encoding), // The first is the sender's address, the second parameter is the sender
NewMailaddress (textbox1.text ));// Recipient's email
Message. subjectencoding = encoding;
Message. Subject = textbox2.text;// Title
M
In the second article of the mail series, this article describes how to use mailmessage and smtpclient in the namespace system. net. Mail to send emails.
Using system;
Using system. collections;
Using system. text;
Using system. net;
Using system. net. mail;
Namespace netmailsend
{
Class programe
{
Public static void main (string [] ARGs)
{
// Mail message
Mailmessage mymail = new mailmessage ();
Mymail. From = new mailaddress ("test@gmail.com ");
My
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.