0

異なるメール ID を使用して自分のメール ID にメールを送信する関数を作成しました。異なるメール ID の設定は、mailpresets テーブルに保存されます。問題は、ループを使用してメールを送信すると、メールが受信されることです。

<cffunction name="processFormSubmission">
    <cfset template = model("mailpreset").findAll() />
    <cfloop query="template">
        <cfmail from="#template.fromEmail#" to="test@test.com" 
                  server="#template.serverHostName#" 
                  username="#template.serverUserName#" 
                  port="#template.serverPort#" 
                  password="#template.serverPassword#" 
                  subject="Mail from #template.fromEmail#" 
                  type="html" 
                  usessl="#template.useSSL#" usetls="#template.useTLS#">

                #template.fromEmail#
            </cfmail>
        </cfloop>
        <cfabort>
    </cffunction>

しかし、メールの送信に単一のメールプリセットを使用すると、メールが送信されません。以前の方法で送信した場合と同じメールプリセットでメールが送信されます。

<cffunction name="processFormSubmission">
    <cfset template = model("mailpreset").findAll(where="id=7") />

    <cfmail from="#template.fromEmail#" to="test@test.com" 
            server="#template.serverHostName#" 
            username="#template.serverUserName#" 
            port="#template.serverPort#" 
            password="#template.serverPassword#" 
            subject="Mail from #template.fromEmail#" 
            type="html" usessl="#template.useSSL#" 
            usetls="#template.useTLS#">

            #template.fromEmail#
    </cfmail>

    <cfabort>
</cffunction>

その背後にある問題は何ですか?

4

0 に答える 0