WSHを利用してメールを送信する例です。
今時のメール送信はSMTP Authなどが実装されている例が多いのですが、
今回の例は、SMTP Authには対応していません。(別途、紹介します)

パラメータは以下の通り。

Send_Msg “SMTPモード”,”SMTPサーバ”,”SMTPポート”,”送信元メールアドレス”,”宛先メールアドレス”,”CC宛先”,”BCC宛先”,”件名”,”本文”


Dim STR_SmtpHost
Dim STR_SmtpPort
Dim STR_MsgFrom
Dim STR_MsgTo
Dim STR_MsgCc
Dim STR_MsgBcc
Dim STR_MsgSubject
Dim STR_MsgBody

STR_SmtpHost = "xxx"
STR_SmtpPort = "xx"
STR_MsgFrom = "xxx@xxx.com"
STR_MsgTo = "xxx@yyy.com"
STR_MsgCc = ""
STR_MsgBcc = ""
STR_MsgSubject = "aaaa"
STR_MsgBody = "bbb"

Call Send_Msg(STR_SmtpHost, STR_SmtpPort, STR_MsgFrom, STR_MsgTo, STR_MsgCc, STR_MsgBcc, STR_MsgSubject, STR_MsgBody)

Function Send_Msg(STR_SmtpHost, STR_SmtpPort, STR_MsgFrom, STR_MsgTo, STR_MsgCc, STR_MsgBcc, STR_MsgSubject, STR_MsgBody)

Set OBJ_EMail = CreateObject("CDO.Message")

OBJ_EMail.From = STR_MsgFrom
OBJ_EMail.Subject = STR_MsgSubject
OBJ_EMail.TextBody = STR_MsgBody

OBJ_EMail.To = STR_MsgTo
OBJ_EMail.Cc = STR_MsgCc
OBJ_EMail.Bcc = STR_MsgBcc

OBJ_EMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
OBJ_EMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = STR_SmtpHost
OBJ_EMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = STR_SmtpPort

OBJ_EMail.Configuration.Fields.Update
OBJ_EMail.Send

Set OBJ_EMail = Nothing

End Function

16 Comments

  1. 우리카지노 says:

    우리카지노

  2. W88 says:

    … [Trackback]

    […] Find More on that Topic: dragon-ark.com/archives/278 […]

  3. 대밤 says:

    … [Trackback]

    […] There you can find 78083 additional Information on that Topic: dragon-ark.com/archives/278 […]

  4. microsoft exchange online plan 2 says:

    … [Trackback]

    […] There you will find 77053 additional Information on that Topic: dragon-ark.com/archives/278 […]

  5. exchange hosting fiyat says:

    … [Trackback]

    […] Read More to that Topic: dragon-ark.com/archives/278 […]

  6. microsoft exchange online plan 1 says:

    … [Trackback]

    […] There you can find 6793 more Info on that Topic: dragon-ark.com/archives/278 […]

  7. lenovo sunucu teknik servis says:

    … [Trackback]

    […] Read More here to that Topic: dragon-ark.com/archives/278 […]

  8. bilişim danışmanlık firmaları says:

    … [Trackback]

    […] Read More on that Topic: dragon-ark.com/archives/278 […]

  9. HP Servis says:

    … [Trackback]

    […] Read More to that Topic: dragon-ark.com/archives/278 […]

  10. world market link says:

    … [Trackback]

    […] Find More to that Topic: dragon-ark.com/archives/278 […]

  11. DevOps automation consulting says:

    … [Trackback]

    […] Find More on that Topic: dragon-ark.com/archives/278 […]

  12. ถ้วยฟอยล์ says:

    … [Trackback]

    […] Read More Info here to that Topic: dragon-ark.com/archives/278 […]

  13. sunucu teknik destek says:

    … [Trackback]

    […] Read More on on that Topic: dragon-ark.com/archives/278 […]

  14. Supercritical CO2 Extraction Machine says:

    … [Trackback]

    […] Read More on that Topic: dragon-ark.com/archives/278 […]

  15. Sveriges pass says:

    … [Trackback]

    […] Read More to that Topic: dragon-ark.com/archives/278 […]

Leave a Reply