Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Aktualisiert: 05. Dezember 2005
Verwenden Sie den Assistenten zum Konfigurieren von Datenbank-E-Mail oder gespeicherte Prozeduren von Datenbank-E-Mail, um öffentliche Datenbank-E-Mail-Profile zu erstellen. Mit einem öffentlichen Profil kann jeder Benutzer mit Zugriff auf die msdb-Datenbank E-Mail mithilfe dieses Profils senden.
So erstellen Sie ein öffentliches Profil für Datenbank-E-Mail mithilfe von Transact-SQL
Erstellen Sie mindestens ein Datenbank-E-Mail-Konto für das Profil. Weitere Informationen zum Erstellen von Konten für Datenbank-E-Mail finden Sie unter Vorgehensweise: Erstellen von Konten für Datenbank-E-Mail (Transact-SQL).
Führen Sie die gespeicherte Prozedur msdb.dbo.sysmail_add_profile_sp aus, um das Profil zu erstellen, und geben Sie Folgendes an:
- Den Namen des zu erstellenden Profils.
- Eine optionale Beschreibung des Profils.
Führen Sie für jedes Konto msdb.dbo.sysmail_add_profileaccount_sp aus, um dem Profil das Konto hinzuzufügen.
Erteilen Sie öffentlichen Zugriff auf das Profil, indem Sie msdb.sysmail_add_principalprofile_sp mit 'public' als @principal_name ausführen, oder mit 0 als @principal_id.
Beispiel
Im folgenden Beispiel wird ein Datenbank-E-Mail-Konto und ein Datenbank-E-Mail-Profil erstellt. Dann wird das Konto dem Profil hinzugefügt, und allen Benutzern in der msdb-Datenbank wird Zugriff auf das Profil gewährt.
-- Create a Database Mail account
EXECUTE msdb.dbo.sysmail_add_account_sp
@account_name = 'AdventureWorks Public Account',
@description = 'Mail account for use by all database users.',
@email_address = 'db_users@Adventure-Works.com',
@replyto_address = 'danw@Adventure-Works.com',
@display_name = 'AdventureWorks Automated Mailer',
@mailserver_name = 'smtp.Adventure-Works.com' ;
-- Create a Database Mail profile
EXECUTE msdb.dbo.sysmail_add_profile_sp
@profile_name = 'AdventureWorks Public Profile',
@description = 'Profile used for administrative mail.' ;
-- Add the account to the profile
EXECUTE msdb.dbo.sysmail_add_profileaccount_sp
@profile_name = 'AdventureWorks Public Profile',
@account_name = 'AdventureWorks Public Account',
@sequence_number =1 ;
-- Grant access to the profile to all users in the msdb database
EXECUTE msdb.dbo.sysmail_add_principalprofile_sp
@profile_name = 'AdventureWorks Public Profile',
@principal_name = 'public',
@is_default = 1 ;
Siehe auch
Aufgaben
Vorgehensweise: Erstellen von privaten Datenbank-Mailprofilen (Transact-SQL)
Konzepte
Andere Ressourcen
Neues Profil (Datenbank-E-Mail)
Konfigurationsaufgabe auswählen (Datenbank-E-Mail)
Assistent zum Konfigurieren von Datenbank-E-Mail
sysmail_add_account_sp (Transact-SQL)
sysmail_add_principalprofile_sp (Transact-SQL)
sysmail_add_profile_sp (Transact-SQL)