Teach you how to properly configure MySQL database SQL Mail

Source: Internet
Author: User
Tags mail mysql mysql database

This article uses personal experience to solve SQL Mail configuration and use.

The main thing to do with SQL Mail is to do this:

> Users registered online, the system will randomly generated passwords sent to the user's registered email.

> users will send the content to the user's email when the forum post has a reply.

Because the above process is completed in the stored procedure, so the foreground program to avoid the transmission of parameters, and no need to use third-party components to complete, more convenient.

1. In order to use SQL Mail, first of all, your server must have SMTP service, I did not install Win2000 Server from the SMTP, but with imail6.04 SMTP, feel more stable, more powerful.

2. Install a mail system, I installed Outlook 2000, I found that when configuring mail profile, if you do not install Outlook but use other third-party programs, Win2K Chinese Server version in the Control Panel can not find a "mail" item.

3. After you install Outlook and then refresh the control Panel, you will find the mail item, double-click the configuration of the message, name the profile (assuming myprofile) for later SQL Mail, and set the properties in the configuration file.

4. Start Outlook (set to use Myprofile as the default profile), test to send and receive messages, and confirm that Outlook is working properly.

5. With the current domain account to start SQL Server, in Enterprise Manager support Services, click on the properties of SQL Mail, you can see in the profile selection, the Myprofile configuration file has just been defined (you can also define multiple profiles), Select this profile to test, SQL will return the successful start and end of a MAPI session information, if there is an error or did not find the mail profile, it must be you start SQL Server with a problem with the account.

6. You can now send SQL Mail in Query Analyzer using xp_sendmail, which is in the following format:

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']

Where the @recipients is required.

Parameter description:

Parameter description

@recipients recipients, separated by commas in the middle.

@message the information to send.

@query determine a valid query that executes and attaches to the message, this query can refer to any object except the Insert table and the Delete table in the trigger.

@attachments attachments.

@copy_recipients cc.

@blind_copy_recipients secret send.

@subject title.

@attach_results specifies that the query result is sent as an attachment.

@no_header column name that does not send query results.

The user name @set_user the query join, default to Guset.

@dbuse the database used by the query, default is the default database.

7. However, if you are using SQL Mail in a Web application, there are some issues to be resolved: First, the application is connected to the database account, I am in the Web site program database connection is using UDL file, account for Dbguest, this is a common account, You must also find xp_sendmail in the extended stored procedure of the master library, add dbguest to the user in its properties, and select Exec permissions.

OK, now set up, run the website program, test user registration, there is little delay.

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.