Home Database Mysql Tutorial 教你怎样正确配置MySQL数据库SQL Mail_MySQL

教你怎样正确配置MySQL数据库SQL Mail_MySQL

Jun 01, 2016 pm 02:04 PM
sql how database document Inquire correct user mail Configuration

 

本文用个人经历来讲解SQL Mail的配置与使用。

 

用SQL Mail主要是要完成这样的功能:

>用户在网上注册后,系统将随机产生的密码发送到用户登记的Email。

>用户在论坛的帖子有回复时将内容发送到用户的Email。

因为上述过程都是在存储过程中完成的,所以避免了前台程序对参数的传输处理,也不需要再用第三方的组件完成,比较方便。

 

1.为了使用SQL Mail,首先你的服务器上得有SMTP服务,我没有安装win2000 server自带的SMTP,而是用imail6.04的SMTP,感觉比较稳定,功能也比较强。

2.安装一个邮件系统,我安装了outLook 2000,我发现在配置邮件profile时,如果不安装outLook而是用别的第三方程序,win2k中文server版在控制面板中就找不到“邮件”一项。

3.安装完outlook后再刷新控制面板,就会找到“邮件”一项,双击进行邮件的配置,为配置文件起一个名字(假设为myProfile),以便以后SQL Mail使用,在该配置文件中设置各项属性。

4.启动outlook(设置为用MyProfile作为默认的配置文件),测试进行收发邮件,确认outlook工作正常。

5.用当前的域帐户启动SQL Server,在企业管理器的支持服务中,点击SQL Mail的属性,可以看到在配置文件选择中,出现了刚才定义的myProfile配置文件(你也可以定义多个profile),选择这个配置文件进行测试,SQL将返回成功开始和结束一个MAPI会话的信息,如果出现错误或是没有找到邮件配置文件,那一定是你启动SQL server用的帐号有问题。

6.现在你就可以在查询分析器中用XP_sendmail这个扩展存储过程发送SQL Mail了,格式如下:

 

<ccid_code></ccid_code>xp_sendmail {[@recipients =] 'recipients [;...n]'} 
[,][@message =] 'message'] 
[,][@query =] 'query'] 
[,][@attachments =] attachments] 
[,][@copy_recipients =] 'copy_recipients [;...n]'
[,][@blind_copy_recipients =] 'blind_copy_recipients [;...n]'
[,][@subject =] 'subject']
[,[@type =] 'type'] 
[,][@attach_results =] 'attach_value']
[,][@no_output =] 'output_value'] 
[,][@no_header =] 'header_value'] 
[,][@width =] width] 
[,][@separator =] 'separator'] 
[,][@echo_error =] 'echo_value'] 
[,][@set_user =] 'user'] 
[,][@dbuse =] 'database']
Copy after login

其中@recipients是必需的。

参数说明:

 

参数 说明

@recipients 收件人,中间用逗号分开。

@message 要发送的信息。

@query 确定执行并依附邮件的有效查询,除触发器中的插入表及删除表外,此查询能引用任何对象。

@attachments 附件。

@copy_recipients 抄送。

@blind_copy_recipients 密送。

@subject 标题。

@attach_results 指定查询结果做为附件发送。

@no_header 不发送查询结果的列名。

@set_user 查询联接的用户名,默认为Guset。

@dbuse 查询所用的数据库,默认为缺省数据库。

7.不过,如果是在web应用中使用SQL mail,还有一些问题要解决:首先,就是应用程序中连接数据库的帐号,我在网站程序中的数据库连接是使用UDL文件,帐号为DbGuest,这是一个普通帐户,所以还必须在master库的扩展存储过程找到XP_sendmail,并在其属性中增加DbGuest这个用户,并选择EXEC权限。

好了,现在设置完毕,运行网站程序,测试用户注册,几乎没有什么延迟。

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 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)

iOS 18 adds a new 'Recovered' album function to retrieve lost or damaged photos iOS 18 adds a new 'Recovered' album function to retrieve lost or damaged photos Jul 18, 2024 am 05:48 AM

Apple's latest releases of iOS18, iPadOS18 and macOS Sequoia systems have added an important feature to the Photos application, designed to help users easily recover photos and videos lost or damaged due to various reasons. The new feature introduces an album called "Recovered" in the Tools section of the Photos app that will automatically appear when a user has pictures or videos on their device that are not part of their photo library. The emergence of the "Recovered" album provides a solution for photos and videos lost due to database corruption, the camera application not saving to the photo library correctly, or a third-party application managing the photo library. Users only need a few simple steps

Detailed tutorial on establishing a database connection using MySQLi in PHP Detailed tutorial on establishing a database connection using MySQLi in PHP Jun 04, 2024 pm 01:42 PM

How to use MySQLi to establish a database connection in PHP: Include MySQLi extension (require_once) Create connection function (functionconnect_to_db) Call connection function ($conn=connect_to_db()) Execute query ($result=$conn->query()) Close connection ( $conn->close())

How to handle database connection errors in PHP How to handle database connection errors in PHP Jun 05, 2024 pm 02:16 PM

To handle database connection errors in PHP, you can use the following steps: Use mysqli_connect_errno() to obtain the error code. Use mysqli_connect_error() to get the error message. By capturing and logging these error messages, database connection issues can be easily identified and resolved, ensuring the smooth running of your application.

Apple's iOS 18 mail app gets AI wings: enhanced search, smart writing/reply, classification and summarization, etc. Apple's iOS 18 mail app gets AI wings: enhanced search, smart writing/reply, classification and summarization, etc. Jun 11, 2024 pm 09:34 PM

According to news on June 7, technology media AppleInsider published a blog post yesterday, revealing that Apple is developing Project BlackPearl internally, which mainly enhances the email application in iOS18 and macOS15 systems, allowing AI to help users compose and reply to emails. The relevant content is summarized as follows: Enhanced Search Project BlackPearl first enhances email search results, which will display more information from address books, locations and locally stored documents. Smart Replies In addition, the new "Smart Replies" function in the email application will provide appropriate reply content based on the locally running large language model (LLM) Ajax and combined with the context of the email. compose mail

How to connect to remote database using Golang? How to connect to remote database using Golang? Jun 01, 2024 pm 08:31 PM

Through the Go standard library database/sql package, you can connect to remote databases such as MySQL, PostgreSQL or SQLite: create a connection string containing database connection information. Use the sql.Open() function to open a database connection. Perform database operations such as SQL queries and insert operations. Use defer to close the database connection to release resources.

How to use database callback functions in Golang? How to use database callback functions in Golang? Jun 03, 2024 pm 02:20 PM

Using the database callback function in Golang can achieve: executing custom code after the specified database operation is completed. Add custom behavior through separate functions without writing additional code. Callback functions are available for insert, update, delete, and query operations. You must use the sql.Exec, sql.QueryRow, or sql.Query function to use the callback function.

How to add and manage users in Google Manager How to add and manage users in Google Manager Sep 02, 2024 pm 02:41 PM

How to add and manage users in Google Manager? Google Chrome supports multiple users to log in, so we don’t have to worry about logging in across devices. If we have many users, we need to add management. Some friends may not know how to operate. Don't worry, the editor has compiled a detailed step-by-step tutorial for everyone today. If you are interested, come and take a look with the editor. Detailed step-by-step tutorial instructions 1. After turning on the computer, find the installed Google Chrome icon on the desktop and double-click to open it, as shown in the picture below. 2. Click the three dots icon in the upper right corner of Google Chrome, as shown in the picture below. 3. Click the [Settings] option in the drop-down menu of Google Chrome, as shown in the figure below. 4. In the Google Chrome settings interface that opens, click [Manage ch

How to handle database connections and operations using C++? How to handle database connections and operations using C++? Jun 01, 2024 pm 07:24 PM

Use the DataAccessObjects (DAO) library in C++ to connect and operate the database, including establishing database connections, executing SQL queries, inserting new records and updating existing records. The specific steps are: 1. Include necessary library statements; 2. Open the database file; 3. Create a Recordset object to execute SQL queries or manipulate data; 4. Traverse the results or update records according to specific needs.

See all articles