Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Maarten Boer 61 posts 82 karma points
    May 25, 2011 @ 21:00
    Maarten Boer
    0

    sendmail to more then one recipient ?

    Hi,

    Is it possible to send mail to more then one recipient ?
    Like:

    umbraco.library.SendMail(Senderemail.Text, "[email protected];[email protected]", Subject.Text, Body.Text, false);

    When i load this ascx i get an error:

    Error reading usercontrols/sendmail.ascx

    The following list shows the Public Properties from the Control. By checking the Properties and click the "Save Properties" button at the bottom, umbraco will create the corresponding Macro Elements.

     

    System.Web.HttpParseException (0x80004005): There can be only one 'control' directive. ---> System.Web.HttpParseException (0x80004005): There can be only one 'control' directive. ---> System.Web.HttpException (0x80004005): There can be only one 'control' directive. at System.Web.UI.TemplateParser.ProcessError(String message) at System.Web.UI.TemplateP...............

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    May 25, 2011 @ 23:37
    Lee Kelleher
    0

    Hi Maarten,

    As far as I'm aware, you are delimiting the recipients correctly (by semicolon).

    Does the form/email work when you use a single email address?

    I'm getting a sneaky feeling that there's something else going on here - only from the exception message.

    Cheers, Lee.

  • Maarten Boer 61 posts 82 karma points
    May 25, 2011 @ 23:46
    Maarten Boer
    0

    Yes, single recipient works just fine. I'll post the script tomorrow.
    Maarten

  • Maarten Boer 61 posts 82 karma points
    May 26, 2011 @ 14:07
    Maarten Boer
    0

    Hi Lee,

    As promised here is my code....

    I changed the script a little bit. When i load this usercontrol in the macro, i dont get any error now..

    But when i send this contactform, only the last recipient receives the mail... (not the actual email adresses)

    <%@ Control Language="C#" ClassName="SendmailControl" %>
    <script runat="server">
    protected void SendMail(object sender, EventArgs e)
    {
    string CrLf = "\r\n";

    if (string.IsNullOrWhiteSpace(kname.Text) || string.IsNullOrWhiteSpace(kemail.Text) || string.IsNullOrWhiteSpace(kmessage.Text))
    {
    ResponseLiteral.Text = @"<br><br><p><strong>Error sending the contactform !</strong></p>";
    }
    else
    {
    string body = "The following information has been send from your website:" + CrLf + CrLf;
    body += "name:" + kname.Text + CrLf;
    body += "company:" + kcompany.Text + CrLf;
    body += "email:" + kemail.Text + CrLf;
    body += "telephone:" + ktelephone.Text + CrLf + CrLf;
    body += kmessage.Text + CrLf + CrLf ;
    body += "Kind regards," + CrLf;
    body += kname.Text;

    try
    {
    umbraco.library.SendMail(kemail.Text, "[email protected]; [email protected]", "Contactform from the website", body, false);
    ResponseLiteral.Text = @"<br><br><p>The contactform has been sent...</p>";
    }
    catch (Exception)
    {
    ResponseLiteral.Text = @"<br><br><p><strong>There was a problem sending the contactform.</strong></p>";
    }
    }

    FormPanel.Visible = false;
    ResponsePanel.Visible = true;
    }
    </script>

    <form runat="server">
    <asp:Panel ID="FormPanel" CssClass="div_formpanel" runat="server">
    <label class="div_contact_item" style="top:56px">name*</label>
    <br />
    <div id="div_contact_invul" style="top:52px">
    <asp:TextBox ID="kname" runat="server" CssClass="contact_data" /><br />
    </div>
    <label class="div_contact_item" style="top:89px">company</label><br />
    <div id="div_contact_invul1" style="top:85px">
    <asp:TextBox ID="kcompany" runat="server" CssClass="contact_data" /><br />
    </div>
    <label class="div_contact_item" style="top:121px">email*</label><br />
    <div id="div_contact_invul1" style="top:118px">
    <asp:TextBox ID="kemail" runat="server" CssClass="contact_data" />
    <br />
    </div>
    <label class="div_contact_item" style="top:155px">telephone</label><br />
    <div id="div_contact_invul1" style="top:151px">
    <asp:TextBox ID="ktelephone" runat="server" CssClass="contact_data" /><br />
    </div>
    <label class="div_contact_item" style="top:185px">message*</label><br />
    <div id="div_contact_invul2" style="top:184px">
    <asp:TextBox ID="kmessage" TextMode="multiline" runat="server" CssClass="contact_data1" /><br />
    </div>
    <div id="div_nextpage">
    <asp:Button ID="SendButton" runat="server" Text="send" OnClick="SendMail" CssClass="but_sturen" />
    </div>
    </asp:Panel>
    <asp:Panel ID="ResponsePanel" CssClass="div_antwoordpanel" runat="server" Visible="false">
    <asp:Literal ID="ResponseLiteral" runat="server" />
    </asp:Panel>
    </form>

    Any idea why not both recipients receive the mail  ???

    Also i would like the recipients to be a parameter when i insert the macro in the richtext box.

     

    Maarten

  • Ravi Motha 290 posts 500 karma points MVP 8x c-trib
    May 26, 2011 @ 14:17
    Ravi Motha
    1

    Is the mail server showing you the messages for the delimited users, or is it failing before it gets to the mail send?

  • Maarten Boer 61 posts 82 karma points
    May 26, 2011 @ 17:48
    Maarten Boer
    0

    The mailserver is showing the message, but only to the last recipient...   in this case peter

    umbraco.library.SendMail(kemail.Text, "[email protected]; [email protected]", "Contactform from the website", body, false);
  • Maarten Boer 61 posts 82 karma points
    May 30, 2011 @ 23:36
    Maarten Boer
    0

    I found the solution...
    THE recipients have to be parted with a komma. [email protected], [email protected].

    Maarten

  • Ravi Motha 290 posts 500 karma points MVP 8x c-trib
    May 31, 2011 @ 00:22
    Ravi Motha
    0

    does that apply to both the to and the cc field and apologies for the late responses.

  • Maarten Boer 61 posts 82 karma points
    May 31, 2011 @ 08:13
    Maarten Boer
    0

    Yes Ravi,

    According to .NET

     

    Maarten

Please Sign in or register to post replies

Write your reply to:

Draft