[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 431
  • Last Modified:

Sender Adress in E-mail form results

Hi

I have put a form on my website. There's a perlscript attached to it. It all works ok, but when I recieve the form results in my mailbox, the e-mail doesn't have a sender adress. So it ends up in my spam folder. How can I insert a sender adress?

Thanks
0
msap7222
Asked:
msap7222
  • 7
  • 7
  • 3
  • +1
1 Solution
 
SkyvanManCommented:
I'm confused with your question. Is the form a perl form that does the emailling?
0
 
alexhoganCommented:
Just ask your users for it...

Put on your form a text box that will let them enter their email address.

It would also be a good idea to put a disclaimer on the form someplace that their email addresses will not be sold to any third party and they will not recieve anything that they haven't already agreed to by filling out the form e.t.c...

0
 
SkyvanManCommented:
Yeah but you have to know if he is actually using Perl to do it. All you would need to do is ask them for your email adress and make that be the from adress in the sending script. If you mean that you are using perl to do the sending in saying that you have a perlscript attached to it then I can try to find the exact code for you.
0
Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

 
msap7222Author Commented:
SkyvanMan

You got it right, yes I need the code that does that. Cause when you ask people to fill in their e-mail adress (wich I already did) then the e-mail with the form data still doesn't have a sender name. And yes I am using a Perl script.

Sorry for my English, am from the Netherlands, so...

Thanks

0
 
SkyvanManCommented:
Your english is not bad at all, some words just don't translate directly and that is the way it is with almost every language in comparison with others, I was able to understand what you wanted fine, just wnated to make sure. Anyways I am no Perl expert but it seems you would need to verify that the user is using a valid email adress there is code for that http://www.cgiscript.net/cgi-script/csNews/csNews.cgi?database=perl%2edb&command=viewone&id=4&op=t
Once you have the users email adress verified and lets say it is the variable $FORM{'useremail'} then you would add this code after the line that states the to field.

print MESSAGE "From: $FORM{useremail}\n";

I hope you understand basically you just have to add that line of codebased on the variable for the from field being $FORM{'useremail'}
0
 
Havin_itCommented:
Hi,

Did you install/write the Perl script yourself, or is it offered by your host?

This is by far the most commonly-used form-emailing Perl script in use today, and is quite likely what your host is using (they should have specific info somewhere in a FAQ about using it).

http://www.scriptarchive.com/readme/formmail.html#form_config

The link will take you to the info about how to set up your form correctly. You don't *have* to check the email address's validity, as the script will do that, but it's generally a good idea to save on wasted mailings.  The important part is getting the right name for the 'email' form field that the script is expecting, e.g. in Formmail.pl it is 'email' and must be case-sensitive.
0
 
msap7222Author Commented:
Hi Havin_it

I do use the PerlScript you are talking about. But I can't find anything on how to insert a sender adress, in the e-mail I recieve with the form results.
It doesn't even have to be the acctual adress of the sender but I can also be somthing like; Form results or whatever.

Thanks
0
 
Havin_itCommented:
From the above linked FAQ page:

<snip>
Field:       email
Description:       This form field will allow the user to specify their return e-mail address. If you want to be able to return e-mail to your user, I strongly suggest that you include this form field and allow them to fill it in. This will be put into the From: field of the message you receive. If you want to require an email address with valid syntax, add this field name to the required field.
Syntax:       <input type=text name="email">
</snip>

From experience I can tell you that if you don't use this field in your form, the mail will arrive with a From: address of 'nobody@yourserver.yourwebhost.com' so you may as well use this field, that way when you get the mail you can reply directly instead of cut and paste from the message body.

If you're asking about setting the Subject: field of the email, try this (op.cit.)

<snip>
Field:       subject
Description:       The subject field will allow you to specify the subject that you wish to appear in the e-mail that is sent to you after this form has been filled out. If you do not have this option turned on, then the script will default to a message subject: WWW Form Submission.
Syntax:       If you wish to choose what the subject is:
<input type=hidden name="subject" value="Your Subject">

To allow the user to choose a subject:
<input type=text name="subject">
</snip>

Do these help?  You should really have a good read of that link, the form is quite a powerful tool with the many opotions that are listed there.  If you need anything clarified, please ask.
0
 
msap7222Author Commented:
Ok I can see that. But it's not what I mean.

I just want the sender name to be filled in automaticly, so that it is the same in every mail (with form results) I get. I want it to be let's say "commercial information", how can I do this?

Thank you
0
 
Havin_itCommented:
You mean you want to 'spoof' the From: address field so it is not actually an email address?

Rather an odd thing to do (what's wrong with the Subject: field for this purpose?), but from my reading of the FAQ it should be possible.  It seems to suggest that as long as you don't include the 'email' field in the list of required fields, it won't be validated to check whether it's a valid address.  So, you can simply make this a hidden field in the form:

<input id="email" name="email" type="hidden" value="commercial information">

[If this fails it may be because of the space in "commercial information" causing a parsing error.  Try replacing the space with an underscore or hyphen.]

If you do also intend to have an email entry in the form (to appear in the message body rather than the From: field), then just give this field a different name, e.g.

<input id="mailFrom" name="mailFrom" type="text">

The good thing about Formmail.pl is you can add any field names you want, as well as the ones with special purposes in the script.
0
 
msap7222Author Commented:
Havin_it

Yes well this: <input id="email" name="email" type="hidden" value="commercial information"> does work but nor exactly how I want it to work.
If you open your Outlook inbox, you see all your mails and it says "from", "subject", "recieved".... Now I want that "from" to be filled in as commercial_information. How do I do that?

I want to do this because, other people, within the comapny,  also need to read those emails. With a "from" that's alwyas the samen it's easy for everybody to knwo where the mails came from and what they regard to.

Thanks again
0
 
Havin_itCommented:
I'm a little confused at this point. Can you clarify:

1) Please elaborate on "does work but nor exactly how I want it to work." - describe how the email you received looks, i.e. what _is_ in the 'From:' field?

2) Why isn't using the 'Subject:' field of the email sufficient for the purpose you describe?

3) Are you in a position to edit the Formmail script, or is it managed by your web-host?
0
 
msap7222Author Commented:

I'm making it harder then it is.

1. Well the code you gave me does work, but does not accomplish what I want.

2. Because when an email does not have a "sender adress" it sometimes ends up in the spam folder.

3. Yes I am in the position to edit the Frommail.pl

This is what I want:
http://commercialphotographer.com.au/Image/Sender.jpg
0
 
Havin_itCommented:
Okay, I'm with you now.

Assuming hacking your spam filter so the non-standard Sender field will get through is not an option, then hacking Formmail.pl isn't going to help you at the receiving end.  So, you have two options:

1) Don't use an 'email' field in the form, so the Sender is always the server default (e.g. nobody@myserver.dom), or

2) Put something in the email that will validate as a real address in your mail client, such as commercial-info@webform.com
Then you can add it to the mail client's addressbook with a 'real' name attached, so that (a) the spam filter lets it through and (b) you can add a 'real name', making the client display something like

Sender: "Commercial Info (webform)" <commercial-info@webform.com>

(The mail client shown in your screenshot will only show 'Commercial info (webform)' - even better)

I do suggest using the Subject field as well though, just for completeness.
0
 
msap7222Author Commented:
Hi Thanks again

This will do I think. But who do I do it, what is that something that I should put in the email?:

2) Put something in the email that will validate as a real address in your mail client, such as commercial-info@webform.com
Then you can add it to the mail client's addressbook with a 'real' name attached, so that (a) the spam filter lets it through and (b) you can add a 'real name', making the client display something like


Thanks
0
 
Havin_itCommented:
Doesn't matter really - just anything that has the correct format of an email address, so it will be validated successfully by Formmail.pl and be let through by your own spam-filter.  I used the example of

commercial-info@webform.com

which reads as a real address but is just a dummy (as far as I know!).  You can make it whatever you like though.
The code for this would be

<input type="hidden" name="email" id="email" value="commercial-info@webform.com">

Before you test the form, add this address to your email program's address-book, and/or the 'Whitelist' used by your spam-filter, which tells it which addresses are 'trusted'.  Then you can be sure that the mail will reach you.
0
 
msap7222Author Commented:
Thanks Havin_it.
0
 
Havin_itCommented:
You're welcome - glad if it helped ;)
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 7
  • 7
  • 3
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now