Search

Hello all,

I’m working on a very simple contact form. It just needs to send the information to my client’s email address.

I know there’s been quite a few discussions surrounding the send email issue, but, after reading through dozens of threads, the problem is still persistent.

Here’s my setup:

  • A website-owner DS is attached to the page.
  • Email section is created and attached with these fields: Name, Email, Subject, Message.
  • Event is created, filtered by ‘Send Email’, and references the Email source.
  • This is my form (essentially the one included in the default S2 build):

    <form action="" method="post">
    <xsl:for-each select="events/save-message">
        <p class="{@result}">
            <xsl:choose>
                <xsl:when test="@result = 'success'">Email sent.</xsl:when>
                <xsl:otherwise>The system encountered errors while sending your email. Please check if all the required fields have been filled.</xsl:otherwise>
            </xsl:choose>
        </p>
    </xsl:for-each>
    <fieldset>
        <label class="required">Name <input type="text" name="fields[name]" value="{events/save-message/post-values/name}" /></label>
        <label class="required">Email <input type="text" name="fields[email]" value="{events/save-message/post-values/email}" /></label>
        <label class="required">Subject
            <xsl:choose>
                <xsl:when test="events/save-message/post-values/subject">
                    <input type="text" name="fields[subject]" value="{events/save-message/post-values/subject}" />
                </xsl:when>
                <xsl:otherwise>
                    <input type="text" name="fields[subject]" value="General Enquiry" />
                </xsl:otherwise>
            </xsl:choose>
        </label>
        <label>Message <textarea name="fields[message]" rows="5" cols="21"><xsl:value-of select="events/save-message/post-values/message" /></textarea></label>
        <input name="send-email[recipient]" value="{website-owner/author/email}" type="hidden" />
        <input name="send-email[sender-email]" value="fields[email]" type="hidden" />
        <input name="send-email[sender-name]" value="fields[name]" type="hidden" />
        <input name="send-email[subject]" value="fields[subject]" type="hidden" />
        <input name="send-email[body]" value="fields[message],fields[subject],fields[email],fields[name]" type="hidden" />
    
        <input id="submit" type="submit" name="action[save-message]" value="Send" />
    </fieldset>
    

Everything saves out correctly. Where it breaks down is, no email is sent to the recipient.

Any help offered would be really appreciated!

Take another look over the documentation of the “Send Email” option for events. I think the “recipient” should be an author username rather than the email address itself. This is for spam protection, so that the author’s email address is never exposed to the public.

Yeah, I’ve noticed that some forms are written like so:

<input name="send-email[recipient]" value="admin" type="hidden" />

And I’ve tried that, as well as:

<input name="send-email[recipient]" value="{website-owner/author/username}" type="hidden" />

and also, as a last effort, directly entering the email, just to see if it would send. I still seem to be missing something

Have you tried to manually add a user name?

Maybe your xPath {website-owner/author/username} is in the wrong context node? How does the output on the front-end look like?

Here’s the XML output:

<website-owner>
    <author id="1" user-type="developer" primary-account="no">
        <username>admin</username>
        <name>l bradford</name>
        <email>lindseyb@eyegatemedia.com</email>
    </author>
<website-owner> 

(As you can see from this snippet, I’ve tried entering the raw username, ‘admin’.)

Here’s my input:

<input name="send-email[recipient]" value="{website-owner/author/username}" />

And here’s the results output (blank):

<input name="send-email[recipient]" value="" />

Are you by any chance working on localhost? In this case everything will most likely be correct but your server won’t send mails.

I’m working remotely, Symphony 2.1.1. :/

Concerning your resulting output: as the value is empty your xPath seems to be incorrect. Try {/data/website-owner/author/username}.

Are there any related entries in the Symphony log (/manifest/log/)?

Wow, thanks a ton!! I feel really stupid. Proof that my brain doesn’t function at 3AM as well as I’d like to think it does.

Again, many thanks!!

You’re welcome :)

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details