0

CDOSYS 経由で電子メールを送信するコードを書いています。同じASPページの別の場所にメール送信コードを書かなければなりません。everycode で次のスキーマ リンクを使用する必要がありますか? 変数で宣言して使用しようとすると、機能せず、エラーが発生します... 私の従来の ASP Web サイトは Windows Server 2012R2 にデプロイされています ( http://schemas.microsoft.com/cdo/configuration)

mail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'Send the message using the network (SMTP over the network).
mail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = mailsite
mail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
mail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False
mail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60

mail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 'basic (clear-text) authentication
mail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = websiteemail
mail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") =globalpassword
4

1 に答える 1

0

他の場所でのコードの複製を避けるのと同じ方法でコードの複製を避けることができます: 繰り返し行う必要があるものをサブルーチンに入れます。

Sub EmailConfig(mailobj)
    mailobj.Configuration.Fields.Item("http://blahblahblah") = 1
    'etc.
End Sub
于 2014-07-18T17:03:24.343 に答える