search
HomeWeb Front-endHTML TutorialTalking about the practical application of html mailto (e-mail)_HTML/Xhtml_web page production

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
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
如何在Outlook中按发件人、主题、日期、类别、大小对电子邮件进行排序如何在Outlook中按发件人、主题、日期、类别、大小对电子邮件进行排序Feb 19, 2024 am 10:48 AM

Outlook提供了许多设置和功能,可帮助您更有效地管理工作。其中之一是排序选项,可让您根据需要对电子邮件进行分类。在这个教程中,我们将学习如何利用Outlook的排序功能,根据发件人、主题、日期、类别或大小等条件对电子邮件进行整理。这将让您更轻松地处理和查找重要信息,提高工作效率。MicrosoftOutlook是一个功能强大的应用程序,可以方便地集中管理您的电子邮件和日历安排。您可以轻松地发送、接收和组织电子邮件,而内置的日历功能也让您能够方便地跟踪您即将面临的活动和约会。如何在Outloo

当您在 iPhone 上使用“隐藏我的电子邮件”时会发生什么?当您在 iPhone 上使用“隐藏我的电子邮件”时会发生什么?Feb 22, 2024 pm 09:19 PM

Apple提供了一个名为“隐藏邮件地址”的重视隐私的功能,允许用户在需要注册账户的应用程序或网站上隐藏其真实电子邮件地址。我们已经教您如何在iPhone上使用此功能,现在让我们一起看看在日常工作中使用它时可能发生的情况。什么是iPhone上的隐藏邮件地址?“隐藏邮件地址”功能的目的是为了保护您的电子邮件地址隐私。通过为应用程序和网站注册提供临时电子邮件地址的方式,您无需直接提供个人的真实电子邮件地址。这个功能允许您生成多个iCloud电子邮件地址,用于注册不同的服务,从而避免泄露真实的电子邮件地

如何利用C++实现一个简单的电子邮件发送程序?如何利用C++实现一个简单的电子邮件发送程序?Nov 02, 2023 pm 05:35 PM

如何利用C++实现一个简单的电子邮件发送程序?随着互联网的普及,电子邮件已经成为人们日常生活和工作中不可或缺的一部分。在C++编程中,我们可以利用SMTP(SimpleMailTransferProtocol)协议实现一个简单的电子邮件发送程序。本文将介绍如何使用C++编写一个基本的电子邮件发送程序。首先,我们需要准备一些工具和库来实现我们的程序。首先

如何使用Flask-Mail发送电子邮件如何使用Flask-Mail发送电子邮件Aug 02, 2023 am 10:17 AM

如何使用Flask-Mail发送电子邮件随着互联网的发展,电子邮件已经成为了人们沟通的重要工具。在开发Web应用中,有时候我们需要在特定的场景下发送电子邮件,比如用户注册成功后发送欢迎邮件,或者用户忘记密码时发送重置密码邮件等。Flask是一款简单而又灵活的PythonWeb框架,而Flask-Mail是Flask框架下用于发送邮件的扩展库,本文将介绍如何

电子邮件的特点是什么电子邮件的特点是什么Jan 22, 2021 pm 04:10 PM

电子邮件的特点是:1、成本低廉,电子邮件采用存储转发方式在网络上逐步传递信息,不像电话那样直接,但费用较低;2、传播速度快,电子邮件综合了电话通信和邮政信件的特点,它传送信息的速度和电话一样快,几秒钟之内可以发送到世界上任何指定的目的地;3、非常便捷;4、广泛的交流对象,可与世界上任何一个角落的网络用户联系;5、信息多样化,可以是文字、图像、声音等多种形式;6、比较安全。

PHP电子邮件模板:定制化和个性化您的邮件内容。PHP电子邮件模板:定制化和个性化您的邮件内容。Sep 19, 2023 pm 01:21 PM

PHP电子邮件模板:定制化和个性化您的邮件内容随着电子邮件的普及和广泛应用,传统的邮件模板已经不能满足人们对个性化和定制化邮件内容的需求。现在,我们可以通过使用PHP编程语言来创建定制化和个性化的电子邮件模板。本文将为您介绍如何使用PHP来实现这一目标,并提供一些具体的代码示例。一、创建邮件模板首先,我们需要创建一个基本的邮件模板。这个模板可以是一个HTM

电子邮件格式电子邮件格式Apr 26, 2024 am 11:49 AM

1、电子邮件格式包括以下要素:收件人、发件人、主题、正文、附件和日期。2、收件人指定了邮件的接收者,收件人的电子邮件地址通常由用户名和域名组成,用@符号分隔。3、发件人包含了邮件的发件人信息,包括姓名和电子邮件地址,这些信息显示在邮件的头部,向接收者展示了发件人的身份。4、主题是对邮件内容的简要概述,它通常是一个简洁而有意义的短语,能够帮助接收者快速了解邮件的主要内容。

电子邮件地址是什么?怎么填写电子邮件地址是什么?怎么填写Jan 05, 2024 pm 02:33 PM

电子邮件地址是雷·汤姆林森主创的邮箱固定格式:user@mail.server.name,类似于邮寄普通信信件时收信人的地址。格式中user是收件人的用户名,mail.server.name是收件人的电子邮件服务器名,它还可以是域名或十进制数字表示的IP地址。Internet中每个用户的电子邮箱地址都具有惟一性,这样可使邮件的收发更加方便、准确。

See all articles

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 agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool