• I have a form where which includes two email addresses.
    [teacher-email] is required
    [parent-email] is optional

    My mail template includes:
    To: [teacher-email],[parent-email]

    This shows a configuration error, presumably because [parent-email] is not set as a required field. I assume this is just a warning.

    The form appears to work Ok if the user does not enter the [parent-email] field. The email is only sent to [teacher-email], but I would appreciate confirmation that Contact Form 7 is designed to discard the unused email address.

    Alternatively, could I include code somewhere which would replace a blank email address with, for example, [email protected]

    Andy

Viewing 3 replies - 1 through 3 (of 3 total)
  • ciao @andynz,
    why don’t you use the second e-mail for purpose?

    OR why not use the “additional header” and add also “Cc:” or “Bcc”?

    Thread Starter andynz

    (@andynz)

    Thanks for taking the trouble to reply, but your suggestion doe not really address the problem which is:
    How do I include an email address in the mail template (to, cc, bcc, 2nd email or wherever) if the email tag may be empty?

    Andy

    yes if empty it was discarded (throwing an error).

    but you can use “wpcf7_before_send_mail” filter to check and abort the submission.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Optional email address’ is closed to new replies.