Jump to content


Photo

EmailLink and EmailLinkForm


  • Please log in to reply
49 replies to this topic

#1 jaredc

jaredc

    Loves Etomite Forums!

  • Member
  • PipPipPipPip
  • 1,193 posts

Posted 22 December 2004 - 08:01 PM

I have added a new snippet to the Snippet Library!

Snippet name: EmailLink and EmailLinkForm
Author: jaredc
Version: .6e (Beta)
More info: View this snippet
Demo URL: Snippet Test Site
Description:

A set of two snippets. One makes it easy for non-tech users to add an "email link" that points to an online form. The other is for the form itself.

Installation is pretty simple. Download the snippets and save them in your Etomite installation as:
EmailLink
and
EmailLinkForm

Create a new page with [[EmailLinkForm]] as the content. Make a note of the id number of this page. Modify the EmailLinkForm snippet to include email domains you want, and change label text on the form itself.

Go to your EmailLink snippet and set the config value for your formId (the form page id you made note of above).

Then on any page, you just type in:
[[EmailLink?address=someaddress@domain.com]] and a link will be created for you that points to the form. There are other things you can type in as well, to fine tune it, but that's the basic.

No email address ever hits the browser- making it good against spam bots. And though the querystring isn't too hard to figure out, you can't just alter it to send email anywhere, because you can define which domains mail can be sent to.

Attached Files



#2 jaredc

jaredc

    Loves Etomite Forums!

  • Member
  • PipPipPipPip
  • 1,193 posts

Posted 05 January 2005 - 08:56 PM

Version 0.6b

- removed bug that didn't allow for upper case characters in email address
- added a line of documentation that no one will notice :-)

#3 jaredc

jaredc

    Loves Etomite Forums!

  • Member
  • PipPipPipPip
  • 1,193 posts

Posted 11 January 2005 - 02:14 PM

Version 0.6c

- XHTML strict validation (if that's important to you).

#4 123

123

    Etomite Forum Newbie

  • Member
  • 23 posts

Posted 25 January 2005 - 05:58 AM

I have this dafault message:

"Email form is unavailable for that address."


1)Im on localhost. Is this the answer?

2)I need a more detailed explanation about configuring this snippet.

#5 jaredc

jaredc

    Loves Etomite Forums!

  • Member
  • PipPipPipPip
  • 1,193 posts

Posted 25 January 2005 - 12:41 PM

Ok two things-

First, when you request support for a certain snippet, could you please make that request in that snippets support forum? That's what it's there for and it will give the future users of the snippet ONE place to go to look for other users issues. This will hopefully help resolve issues in a more timely manner.

@deanstev- can we please move this to the EmailLink and EmailLinkForm support forum?

Ok, now to answer the question. The email form, by default, has this configuration for allowed email addresses:

  // $emailDomains [ string ]
   // An array of allowed email domains (what comes after the @ sign).
   // Leave empty if you want to allow it to go anywhere
   //$emailDomains = array(); // Use this line only if you want to allow all
   $emailDomains[] = 'yourdomain.com';
   $emailDomains[] = 'yourOtherDomain.com';
So basically, it will not work in the default setup (unless you happen to be sending email to "yourdomain.com" or "yourOtherDomain.com"... which seems unlikely). This is intentional as this is a more secure option than allowing everything, which is another alternative.

So what you need to do is decide what email addresses you want to ALLOW this form to send to. If you don't care where it goes (not recommended) you can do this:

  // $emailDomains [ string ]
   // An array of allowed email domains (what comes after the @ sign).
   // Leave empty if you want to allow it to go anywhere
   $emailDomains = array(); // Use this line only if you want to allow all
That is, remove the "dummy" domains and set the array to empty. This will allow the mail to be sent anywhere.

A better idea, is to figure out which domains your common emails are sent to. Say I work for ACME and I know I'll need email sent to a bunch of people in the home office, who have emails like username@acmecorp.com AND the non-profit sector too: username@acmegiving.org. Then I would set the configuration like so:

  // $emailDomains [ string ]
   // An array of allowed email domains (what comes after the @ sign).
   // Leave empty if you want to allow it to go anywhere
   //$emailDomains = array(); // Use this line only if you want to allow all
   $emailDomains[] = 'acmecorp.com';
   $emailDomains[] = 'acmegiving.org';
You might want to send email to only one domain, say acmegiving.org, then you would delete the line that allows acmecorp.com.

This discussion would not be complete without emphasizing that this form ONLY works when used with the EmailLink snippet as well. EmailLink is responsible for generating a link to the form in such a way that the form will accept the address - all while hiding the address from spam-bots. So you must use EmailLink to get to the form. Otherwise, the form will give you the error you show above.

Those are the two most common reasons your form would fail: improper config, or not using the EmailLink snippet.

#6 123

123

    Etomite Forum Newbie

  • Member
  • 23 posts

Posted 26 January 2005 - 05:29 AM

thanks again. you are always ready to help.
Sorry about the support forum question.

#7 Dean

Dean

    Loves Etomite Forums!

  • Admin
  • 4,790 posts

Posted 26 January 2005 - 07:50 PM

@deanstev- can we please move this to the EmailLink and EmailLinkForm support forum?


Your wish is my command :D - I was waiting for it to dissapear as it is the first time that I have "merged" topics - lol

#8 jaredc

jaredc

    Loves Etomite Forums!

  • Member
  • PipPipPipPip
  • 1,193 posts

Posted 29 January 2005 - 04:46 AM

I have NOT updated this snippet in the Snippet Library!

Sorry false alarm. Darn Mac and "whole mouse is a button" idea...

*walks away wondering how in the world he accidentally hit the "edit" button.*

#9 Foton

Foton

    Etomite Forum Newbie

  • Member
  • 10 posts

Posted 31 January 2005 - 10:07 AM

Hi,

This could be a very usefull snippet to me. It is a very easy way the make a link to the form.
Unfortunaly is does not sent any email.
I changed the ''Emaildomains'' into mine in EmailLinkForm
And also the right call for the form on the page itself.
It does show the form, but after entering it does not sent the email.
Did I forget something to config?

Thanks for this wonderfull snippet!

#10 jaredc

jaredc

    Loves Etomite Forums!

  • Member
  • PipPipPipPip
  • 1,193 posts

Posted 31 January 2005 - 12:38 PM

Hmm...

Is PHP allowed to send mail with your host?

After you try to send, does it give an error or just the form still? (If it is the form, are the fields still filled out or are they reset?)

Is there a URL you could give me so I can take a look (you can post here or PM me if you prefer)?

#11 Foton

Foton

    Etomite Forum Newbie

  • Member
  • 10 posts

Posted 31 January 2005 - 12:49 PM

Hmm...

Is PHP allowed to send mail with your host?

After you try to send, does it give an error or just the form still? (If it is the form, are the fields still filled out or are they reset?)

Is there a URL you could give me so I can take a look (you can post here or PM me if you prefer)?


Yes, PHP is allowed to sent email.
After send it returns to an empty form.

Check your PM for the url.

Thanks for the quick reply!

#12 jaredc

jaredc

    Loves Etomite Forums!

  • Member
  • PipPipPipPip
  • 1,193 posts

Posted 31 January 2005 - 02:01 PM

The EmailLinkForm snippet MUST NOT BE CACHED. Either block caching on the whole page it is on, or put the snippet on the page as:

[!EmailLinkForm!]

As a side note, it is perfectly acceptable to have the EmailLink snippet cached. The link going to the form is ok cached. But the form must not be.

#13 Foton

Foton

    Etomite Forum Newbie

  • Member
  • 10 posts

Posted 31 January 2005 - 02:15 PM

The EmailLinkForm snippet MUST NOT BE CACHED. Either block caching on the whole page it is on, or put the snippet on the page as:

[!EmailLinkForm!]

As a side note, it is perfectly acceptable to have the EmailLink snippet cached. The link going to the form is ok cached. But the form must not be.


:D That's right. After changing it to [!EmailLinkForm!] the form worked and show a thankyou-submitted-page !

Thanks Jaredc for your superb support!

#14 Guest_akamarvin_*

Guest_akamarvin_*
  • Guests

Posted 15 February 2005 - 09:05 AM

How can I manage to have one of my main menu item to link to the actual form with no other step than clicking this menu item ?
With this 2 snippets mechanism I'm kind of lost...

A guess : create a new document with just the call to the EmailLinkForm snippet (uncached, as you said) with the right parameters to bypass the EmailLink snippet, so when you call the page via the menu, you have the form directly.

Consider I'm noob in Etomite ! there may be a much simpler way that I don't see ...

Thanks

#15 jaredc

jaredc

    Loves Etomite Forums!

  • Member
  • PipPipPipPip
  • 1,193 posts

Posted 15 February 2005 - 01:25 PM

How can I manage to have one of my main menu item to link to the actual form with no other step than clicking this menu item ?

Hmm... that is an interesting question. It's amazing how people come up with ways to use things that authors never think of!

You could do as you say, to modify the EmailLinkForm to have a "default" set of parameters in place so if you hit the form from a standard nav link, the form would be ready to go.

Another option would be to modify the navigation snippet you are using to include an EmailLink snippet call.

But I like the defaults idea. That could be a good new config option. I might have to add that in :D

#16 jaredc

jaredc

    Loves Etomite Forums!

  • Member
  • PipPipPipPip
  • 1,193 posts

Posted 15 February 2005 - 06:23 PM

VERSION UPDATE

** 0.6d **
- Added config option to allow form to stand alone if a "default" email recipient address is provided
- Added ability to include the senders IP address in email footer if desired
- Removed several lines of code that were remnants of another thought process... :-)
- Organized the config options a little bit (into SETTINGS and TEXTS).

While I have updated both snippets to version 0.6d, the EmailLink snippet didn't actually change. I keep the versions the same since they are a set that work together. And this way, you'll always know which version will work with which version.

[This is an automatically created message]

#17 cse

cse

    Etomite Forum Newbie

  • Member
  • 16 posts

Posted 17 February 2005 - 01:35 AM

Does this snippet allow me to add additional fields, like telephone, or company, or address?

#18 jaredc

jaredc

    Loves Etomite Forums!

  • Member
  • PipPipPipPip
  • 1,193 posts

Posted 17 February 2005 - 01:59 AM

No. Not without some serious modification. What all fields were you looking for? (Who knows, this maybe become a config option in a future version :D)

#19 cse

cse

    Etomite Forum Newbie

  • Member
  • 16 posts

Posted 17 February 2005 - 02:08 AM

For now, I just need a few more, but it would be nice for it to be configurable.

I've been tinkering with this all day and can't get it to work for just an address and phone number. However, I did get a, (hidden) subject to work, until I tinkered more with it.

One thing that I'd like to see working is the $name <$email> working in the FROM .... since it would show both.

I'd like my e-mail that comes in to look like this in the body

$name
$email
$address
$phone
$message

That way, I can see all their information, even if it's in the headers, I'd like it in the message body too.

#20 jaredc

jaredc

    Loves Etomite Forums!

  • Member
  • PipPipPipPip
  • 1,193 posts

Posted 17 February 2005 - 03:07 AM

Hmm... well all of that code belongs to another snippet (EmailHandler). I don't mind looking at that, but in the effort to reduce confusion, it should probably be posted in the EmailHandler support forum.

... rolls eyes to ceiling as he ponders ways to add fields to the snippet ...




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users