Home Web Front-end HTML Tutorial Talking about the practical application of html mailto (e-mail)_HTML/Xhtml_web page production

Talking about the practical application of html mailto (e-mail)_HTML/Xhtml_web page production

May 16, 2016 pm 04:40 PM
e-mail

As we all know, mailto is a very practical HTML tag in web design and production. Many friends who have personal web pages like to write their email address in a prominent position on the website, so that once the web browser clicks with the mouse, After the super connection formed by mailto, the default email client software in the current computer system can be automatically opened, such as OutLook Express and Foxmail.

However, since various operating systems and mail clients handle mailto event connections inconsistently, you need to pay attention when applying them in practice;

1. Basic syntax

send email

or





Parameter list:

to 收信人(多个之间用;分割)
suject 主题
cc 抄送
bcc 暗抄送
body 内容(部分邮件客户端支持html格式语句)
The method of passing parameters is the same as passing values ​​between pages. You can use link strings or form

link string

send mail

form method

Copy code
The code is as follows:







2. Mail client differences

The above is a simple syntax application of mailto; but in actual application, depending on the browser client settings of the browser, there will be different effects;

Especially when the body content contains statements in html format, this You need to pay attention when doing so;

Outlook displays the html statement of the body as it is (it is also invalid after escaping the html of the body), so what should we do if we want to wrap the statements in the body when doing Outlook mailto?
has no effect. . Need to use character as a newline symbol;

foxmail will display the corresponding html effect of the html statement of the body;

Of course, you can also use another way to implement a mailto-type client to send emails:

Copy code
The code is as follows:

function SendMail(filePath) {
var path = location.href.substring(0, location.href.lastIndexOf("/")) filePath;
var outlookApp = new ActiveXObject("Outlook.Application");
var nameSpace = outlookApp.getNameSpace( "MAPI");
var mailItem = outlookApp.CreateItem(0);
var mailto = "test@163.com ";
var mailBody= "test this is body html
";
mailItem.Subject = "test title";
mailItem.To = mailto;
mailItem.HTMLBody = mailBody;
if (path != "") {
mailItem.Attachments.Add(path);
}
mailItem. Display(0);
mailItem = null;
nameSpace = null;
outlookApp = null;
}

But this has a big disadvantage: only To support the Outlook client, you need to configure the Internet options and enable "Initialize and script run ActiveX controls not marked as safe".

The Attachments.Add of mailItem is called to add attachments to the email. When there are no attachments, the filePath parameter can be deleted.

If you need to add a CC object, you can call mailItem.Cc. If you need to add a CC object, you can call the mailItem.Bcc method.
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to sort emails by sender, subject, date, category, size in Outlook How to sort emails by sender, subject, date, category, size in Outlook Feb 19, 2024 am 10:48 AM

Outlook offers many settings and features to help you manage your work more efficiently. One of them is the sorting option that allows you to categorize your emails according to your needs. In this tutorial, we will learn how to use Outlook's sorting feature to organize emails based on criteria such as sender, subject, date, category, or size. This will make it easier for you to process and find important information, making you more productive. Microsoft Outlook is a powerful application that makes it easy to centrally manage your email and calendar schedules. You can easily send, receive, and organize email, while built-in calendar functionality makes it easy to keep track of your upcoming events and appointments. How to be in Outloo

What happens when you use Hide My Email on iPhone? What happens when you use Hide My Email on iPhone? Feb 22, 2024 pm 09:19 PM

Apple offers a privacy-focused feature called "Hide Email Address" that allows users to hide their real email addresses on apps or websites that require account registration. We've taught you how to use this feature on your iPhone, now let's take a look at what's possible when using it in your daily work. What is a hidden email address on iPhone? The purpose of the Hide Email Address feature is to protect the privacy of your email address. By providing a temporary email address for application and website registration, you do not need to directly provide a person's real email address. This feature allows you to generate multiple iCloud email addresses for signing up with different services, thus avoiding revealing your true email address.

How to implement a simple email sending program using C++? How to implement a simple email sending program using C++? Nov 02, 2023 pm 05:35 PM

How to implement a simple email sending program using C++? With the popularity of the Internet, email has become an indispensable part of people's daily life and work. In C++ programming, we can use the SMTP (SimpleMailTransferProtocol) protocol to implement a simple email sending program. This article will introduce how to write a basic email sending program using C++. First, we need to prepare some tools and libraries to implement our program. first

How to send email using Flask-Mail How to send email using Flask-Mail Aug 02, 2023 am 10:17 AM

How to use Flask-Mail to send emails With the development of the Internet, email has become an important tool for people to communicate. When developing web applications, sometimes we need to send emails in specific scenarios, such as sending a welcome email after a user successfully registers, or sending a password reset email when a user forgets their password, etc. Flask is a simple and flexible Python Web framework, and Flask-Mail is an extension library for sending emails under the Flask framework. This article will introduce how to

PHP email templates: customize and personalize your email content. PHP email templates: customize and personalize your email content. Sep 19, 2023 pm 01:21 PM

PHP email templates: Customize and personalize your email content With the popularity and widespread use of email, traditional email templates can no longer meet people's needs for personalized and customized email content. Now we can create customized and personalized email templates by using PHP programming language. This article will show you how to use PHP to achieve this goal, and provide some specific code examples. 1. Create an email template First, we need to create a basic email template. This template can be an HTM

What are the characteristics of email What are the characteristics of email Jan 22, 2021 pm 04:10 PM

The characteristics of email are: 1. Low cost. Email uses a store-and-forward method to gradually transmit information on the network. It is not as direct as a phone call, but the cost is lower; 2. It spreads quickly. Email combines telephone communication and postal mail. It can transmit information as fast as a phone call and can be sent to any designated destination in the world within a few seconds; 3. It is very convenient; 4. It has a wide range of communication objects and can be connected to the network in any corner of the world. User contact; 5. The information is diverse and can be in various forms such as text, images, sounds, etc.; 6. It is relatively safe.

Email format Email format Apr 26, 2024 am 11:49 AM

1. The email format includes the following elements: recipient, sender, subject, body, attachment and date. 2. The recipient specifies the recipient of the email. The recipient's email address usually consists of a username and a domain name, separated by the @ symbol. 3. Sender contains the sender information of the email, including name and email address. This information is displayed in the header of the email and shows the sender's identity to the recipient. 4. The subject is a brief summary of the email content. It is usually a concise and meaningful phrase that can help the recipient quickly understand the main content of the email.

What is an email address? How to fill it in? What is an email address? How to fill it in? Jan 05, 2024 pm 02:33 PM

The email address is a fixed format created by Ray Tomlinson: user@mail.server.name, which is similar to the address of the recipient when mailing a regular letter. In the format, user is the recipient's user name, and mail.server.name is the recipient's email server name. It can also be a domain name or an IP address represented by a decimal number. Each user's email address on the Internet is unique, which makes sending and receiving emails more convenient and accurate.

See all articles