Share via


sysmail_add_account_sp (Transact-SQL)

Bir SMTP hesabı hakkında bilgi içeren yeni bir veritabanı posta hesabı oluşturur.

Topic link iconTransact-SQL sözdizimi kuralları

sysmail_add_account_sp  [ @account_name = ] 'account_name',
    [ @email_address = ] 'email_address' ,
    [ [ @display_name = ] 'display_name' , ]
    [ [ @replyto_address = ] 'replyto_address' , ]
    [ [ @description = ] 'description' , ]
    [ @mailserver_name = ] 'server_name' 
    [ , [ @mailserver_type = ] 'server_type' ]
    [ , [ @port = ] port_number ]
    [ , [ @username = ] 'username' ]
    [ , [ @password = ] 'password' ]
    [ , [ @use_default_credentials = ] use_default_credentials ]
    [ , [ @enable_ssl = ] enable_ssl ]
    [ , [ @account_id = ] account_id OUTPUT ]

Bağımsız değişkenler

  • [ @ hesap_adı = ] 'account_name'
    The name of the account to add.account_name is sysname, with no default.

  • [ @ email_address = ] 'email_address'
    Gelen iletiyi göndermek için e-posta adresi.This address must be an internet e-mail address.email_address is nvarchar(128), with no default.Örneğin, bir hesabı SQL Server Aracı adresi alınan e-posta gönderebilir. SqlAgent@Adventure-Works.com.

  • [ @ display_name = ] 'display_name'
    The display name to use on e-mail messages from this account.display_name is nvarchar(128), with a default of NULL.Örneğin, bir hesabı SQL Server Aracı adı görüntülenebilir Posta Göndericisini SQL Server Agent otomatik e-posta iletilerinde.

  • [ @ replyto_address = ] 'replyto_address'
    The address that responses to messages from this account are sent to.replyto_address is nvarchar(128), with a default of NULL.Örneğin, bir hesabın yanıtlar SQL Server Aracı veritabanı yöneticisine görünebilir danw@Adventure-Works.com.

  • [ @ açıklaması= ] 'description'
    Is a description for the account.description is nvarchar(256), with a default of NULL.

  • [ @ mailserver_name = ] 'server_name'
    Bu hesap için kullanılacak SMTP posta sunucusunun IP adresi veya adı.The computer that runs SQL Server must be able to resolve the server_name to an IP address.server_name is sysname, with no default.

  • [ @ mailserver_type = ] 'server_type'
    The type of e-mail server.server_type is sysname, with a default of 'SMTP'..

  • [ @ bağlantı noktası = ] port_number
    The port number for the e-mail server.port_number is int, with a default of 25.

  • [ @ Kullanıcı adı = ] 'username'
    The user name to use to log on to the e-mail server.username is nvarchar(128), with a default of NULL.Bu parametre NULL olduğunda, veritabanı posta bu hesap için kimlik doğrulaması kullanmaz.Posta sunucusu kimlik doğrulaması gerektirmiyorsa, NULL kullanıcı adı için kullanın.

  • [ Parola = ] 'password'
    The password to use to log on to the e-mail server.password is nvarchar(128), with a default of NULL.Bir kullanıcı adı belirtilmediği sürece, bir parola sağlamak için gerek yoktur.

  • [ @ use_default_credentials =] use_default_credentials
    Specifies whether to send the mail to the SMTP server using the credentials of the SQL Server Database Engine.use_default_credentials is bit, with a default of 0.Bu parametre 1'dir, veritabanı posta kimlik bilgileri bilgilerini kullanır Database Engine. Bu parametre 0 olduğunda, veritabanı posta gönderir @ Kullanıcı adı and Parola Aksi halde gönderir posta olmadan parametreleri varsa**@ Kullanıcı adı** and Parola parametreleri.

  • [ @ enable_ssl =] enable_ssl
    Veritabanı posta Güvenli Yuva Katmanı'nı kullanarak iletişimi şifreler olup olmadığını belirtir.Enable_ssl , bir varsayılan değer olan 0 ile biti.

  • [ @ account_id = ] account_id Çıktı
    Returns the account id for the new account.account_id is int, with a default of NULL.

Dönüş Kodu Değerleri

0 (başarılı) veya 1 (hata)

Remarks

Veritabanı posta için ayrı parametreleri sağlar. @ email_address, @ display_name, and @ replyto_address.The @email_address parameter is the address from which the message is sent.The @display_name parameter is the name shown in the From: alan e-posta iletisinin. The @replyto_address parameter is the address where replies to the e-mail message will be sent.Örneğin, bir için kullanılan hesap SQL Server Aracı, yalnızca için kullanılan bir e-posta adresinden e-posta iletileri gönderebilir SQL Server Agent. Böylece alıcı, kolaylıkla belirleyebilir adresi gelen iletileri bir kolay ad görüntülenmelidir SQL Server Aracı, ileti gönderdi. Alıcı bir yanıt, iletiye yanıt olarak kullanılan adresi yerine, veritabanı yöneticisi gidin SQL Server Agent. Bu senaryo için hesabın kullanır. SqlAgent@Adventure-Works.com e-posta adresi.Görünen ad ayarlamak Posta Göndericisini SQL Server Agent otomatik.Hesabın kullanır. danw@Adventure-Works.com e-posta adresi yerine, veritabanı yöneticisi bu hesaptan gönderilen iletilere gelen yanıtların gitmek için adresine yanıt olarakSQL Server Agent. Bu üç parametresi için bağımsız ayarları sağlayarak, veritabanı posta iletileri, gereksinimlerinize uyacak şekilde yapılandırmanıza olanak sağlar.

The @mailserver_type parameter is provided for flexibility in future releases.SQL Server 2005 and later supports the value 'SMTP' for @mailserver_type.

Ne zaman @ use_default_credentials kimlik bilgileri bilgilerini kullanarak SMTP sunucusuna 1 posta gönderilen olur.SQL Server Database Engine. Ne zaman @ use_default_credentials is 0 and a @ Kullanıcı adı and Parola için bir hesap belirtilirse, bu hesabın SMTP kimlik doğrulaması kullanır.The @username and @password are the kimlik bilgileri the account uses for the SMTP server, not kimlik bilgileri for SQL Server or the network that the computer is on.

Saklı yordam sysmail_add_account_sp is in the msdb veritabanı ve tarafından sahibidbo şema.Geçerli veritabanı değilse, üç bölümlü bir adla yordamı yürütülmelidir msdb.

İzinler

yürütmek izinleri için bu yordamı varsayılan üyelere sysadmin sabit sunucu rolü.

Örnekler

Aşağıdaki örnek, adlı bir hesap oluşturur. AdventureWorks Administrator. Hesabın e-posta adresini kullanır. dba@Adventure-Works.com ve SMTP posta sunucusu posta gönderir smtp.Adventure-Works.com. Bu hesabın program gönderilen e-posta iletileri AdventureWorks Automated Mailer üzerinde Kimden: iletinin satırı. Yanıt iletileri yönlendirilir danw@Adventure-Works.com.

EXECUTE msdb.dbo.sysmail_add_account_sp
    @account_name = 'AdventureWorks Administrator',
    @description = 'Mail account for administrative e-mail.',
    @email_address = 'dba@Adventure-Works.com',
    @display_name = 'AdventureWorks Automated Mailer',
    @mailserver_name = 'smtp.Adventure-Works.com' ;