Forum for discussing general topics related to Couch.
6 posts Page 1 of 1
Hi,
is it possible to use the content of a field inside the from-attribute for the
Code: Select all
<cms:send_mail>


Cheers
Hi,

Assuming your field is named 'my_text', you can use its value in any param like this -
Code: Select all
<cms:send_mail from=my_text>
or
<cms:send_mail from="<cms:show my_text />">

Notice the lack of quotes in the first example and the presence of double-quotes in the second.
Please see https://docs.couchcms.com/concepts/sett ... eters.html if you need to know why the distinction is important.

Hope this helps.
I would add that if your editable field is on some other template, fetch it with the 'cms:get_field' tag e.g.
Code: Select all
from="<cms:get_field 'address' masterpage='contact.php' />"


My Documentation, Addons, Functions.
Join COUCH:TALK telegram channel
Hi,
thank you very much.

I have here a form which is send through email:
Code: Select all
<div id="apDiv23">
                    <cms:form method="post">
                        <cms:if k_success>
                            <h1 style="color: #92b42b">Die Rezeptbestellung wurde übermittelt.</h1>
                            <p>Ihr Rezeptwunsch wurde an uns weitergeleitet. Das Rezept liegt in der Regel einen Tag nach Ihrer Bestellung an der Rezeption für Sie abholbereit.</p>
                            <p>Bitte vergessen Sie Ihre <strong>Chipkarte</strong> nicht.</p>
                            <!-- @formatter:off  -->
                            <!-- praxis@hausarzt-koenig33.de -->
                            <cms:send_mail from=frm_mail to='kontakt@janstieler.de' subject='Rezeptbestellung'>
                                Es gibt folgende Rezeptbestellung:

                                <cms:show k_success />
                            </cms:send_mail><!-- @formatter:off  -->
                            <cms:else />
                            <cms:if k_error>
                                <h1 style="color: #ff0000">Es gibt Formular Fehler</h1>
                            </cms:if>
                            <p>
                                <label for="nachname">Nachname*</label> <br />
                                <cms:input type='text' size="30" name="nachname" required='1' />
                                <cms:if k_error_nachname><span style="display:inline-block;color: red;">Pflichtfeld, bitte ausfüllen</span></cms:if> <br />
                            </p>
                            <p>
                                <label for="vorname">Vorname*</label> <br />
                                <cms:input type='text' size="30" name="vorname" required='1' />
                                <cms:if k_error_vorname><span style="display:inline-block;color: red;">Pflichtfeld, bitte ausfüllen</span></cms:if> <br />
                            </p>
                            <p>
                                <label for="datum">Geburtsdatum (tt.mm.jj)</label> <br />
                                <cms:input type='text' size="30" name="datum" />
                            </p>
                            <p>
                                <label for="telefon">Telefonnummer*</label> <br>
                                <cms:input type='text' size="30" name="telefon" required='1' />
                                <cms:if k_error_telefon><span style="display:inline-block;color: red;">Pflichtfeld, bitte ausfüllen</span></cms:if> <br />
                            </p>
                            <p>
                                <label for="mail">E-Mail Adresse*</label> <br>
                                <cms:input type='text' size="30" name="mail" required='1' validator='email' />
                                <cms:if k_error_mail><span style="display:inline-block;color: red;">Pflichtfeld, bitte korrekt ausfüllen</span></cms:if> <br />
                            </p>
                            <p>
                                <label for="adresse1">Straße und Hausnummer</label><br>
                                <cms:input type='text' size="30" name="adresse1" />
                            </p>
                            <p>
                                <label for="adresse2">PLZ und Wohnort</label><br>
                                <cms:input type='text' size="30" name="adresse2" />
                            </p>
                            <p>&nbsp; </p>
                            <p>
                                <label for="medikament">Medikament*</label> <br>
                                <cms:input type='textarea' rows="7" cols="50" name="medikament" required='1' />
                                <cms:if k_error_medikament><span style="display:inline-block;color: red;">Pflichtfeld, bitte korrekt ausfüllen</span></cms:if> <br />
                            </p>
                            <p>
                                <cms:input type="submit" name="submit" value="Abschicken" />
                                <input type="reset" name="button" id="button" value="Löschen" />
                            </p>
                        </cms:if>
                    </cms:form>
                </div>


in the send_mail is the field `frm_mail` used. But I can't find this input here.
And if I change it to `mail` like the input which should use for this than I get a empty sender in the email.
Is there another possibility from where the sendmail gets the input value?

I'm a little bit confused!

The main problem is that some emails are rejected from the server if there is a gmail adress in from.
Is there a possibility to use `reply to` in send_mail? I havn't see this in the docs.

Cheers
A quote from Documentation Tags Reference » form

Suppose a form has two fields named name and password. Upon successful validation of both fields, two variables named after the two fields will get set - frm_name and frm_password. Each will contain the value submitted through them.


Does this clear the confusion?

As to the second problem, the documentation indeeds needs some love. I'm contributing new articles and refresh old articles with new params, examples and tips in Midware » Tags, but unfortunately, tag 'send_mail' was not touched yet.

Tag send_mail does support following parameters: from, reply_to, sender. These can be looked up in the Couch source code, but I have checked and you can use them, the headers 'Reply-To' and 'Sender' will be set.

My Documentation, Addons, Functions.
Join COUCH:TALK telegram channel
Hi,
yes it solved my confusion :)
Thanks!
6 posts Page 1 of 1