假设我正在使用多个电子邮件服务(例如Mailgun,Mailchimp等),现在我想将每个电子邮件服务的凭据存储在数据库中,而不是config / service.php。这样我就可以在不同情况下呼叫/使用不同的电子邮件服务来发送电子邮件。
答案 0 :(得分:2)
这可能不是解决方案,但这肯定会有所帮助, 好的,首先创建这样的数据库
Private Sub WriteXmlToFile(RoboDataSet As DataSet)
If RoboDataSet Is Nothing Then
MessageBox.Show("The DataSet does not exist.")
Return
End If
For Each t As DataTable In RoboDataSet.Tables
MessageBox.Show(t.Rows.Count.ToString)
Next
Dim filename As String = "c:\data\write4.xml"
Using Stream As New System.IO.FileStream(filename, System.IO.FileMode.Create)
RoboDataSet.WriteXml(Stream)
End Using
End Sub
与.env中的字段相同
CREATE TABLE `mail_settings` (
`id` int(10) UNSIGNED NOT NULL,
`mail_driver` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`mail_host` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`mail_port` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`mail_username` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`mail_password` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`mail_encryption` varchar(191) COLLATE utf8mb4_unicode_ci NOT NULL,
`deleted_at` timestamp NULL DEFAULT NULL,
`created_at` timestamp NULL DEFAULT NULL,
`updated_at` timestamp NULL DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
然后设置MailServiceProvider,
MAIL_DRIVER=
MAIL_HOST=
MAIL_PORT=
MAIL_USERNAME=
MAIL_PASSWORD=
MAIL_ENCRYPTION=
我希望这会有所帮助。