Developer Support »

Various questions from a new user  (See more user questions)

Hi

Normally it is not ideal to have your own email address as the From:
address. Normally you would want the email to have the visitor's email
address as the From: address. The change you made will only change the
sender's name in the From: field, not the sender's email address.

This is the code in the script:

$from_name = "";

if(isset($_REQUEST['name']) && !empty($_REQUEST['name'])){$from_name =
stripslashes($_REQUEST['name']);}

$headers = "From: {$from_name} <{$_REQUEST['email']}>";

The first line is meant to have a blank value. It is initialising the
variable, the value is added later if a visitor name is present in the form.

The email address that goes in the From: header comes from
$_REQUEST['email'] which is the email address entered by the visitor.

If you want the above code to work as it is meant to, i.e. to show the
visitor's name and email address in the From: field of the email you
receive, then you must have a name field on your form named "name" and an
email field named "email". Both lower case.

By default the script has a fixed subject. You can make a subject field on
your form which the visitor uses to enter a subject of their own, if you
think this is preferrable. You can see how to do it on this page on my
support section:

https://formtoemail.com/developersupport/selecting_email_subject.php

I would recommend that you have a good read through the items in the support
section.

Any questions, just let me know.

Best wishes.

Charles Sweeney
https://formtoemail.com
The world's easiest feedback script!

----- Original Message -----
Sent: Wednesday, August 06, 2008 8:23 PM
Subject: Re: FormToEmail script


>
>
> Hi Charles
>
> Do you know of this problem (I think it is me) but, I figured out the
> email "from" business- I had to input into your script on line 171
> $from_name='[email protected] - it used to be blank " ". Now my
> emails have me as the sender.
>
> Moreover, I have another question- I couldn't figure out why I couldn't
> get the "subject" to change on my Email headers (all emails said
> "FormToEmail Comments"). So I changed line 167 - $subject="counselling
> inquiry" and now all my emails have this subject. How do you change
> subject for each email I send? or have different forms with different
> subjects- since I had to change the FormToEmail code, all my emails can
> only have one subject ??? What did I do wrong ?
>
> Have you encountered this ?
>
>
> Thanks
>> Hi .
>>
>> Feel free to ask all the questions you like. Feedback is really valuable
>> to
>> me. I like to know what my customers are thinking and what issues they
>> have!
>>
>> That's interesting. I have a test Hotmail account and it works fine.
>> Having said that, your email server could be adding something to it that
>> Hotmail doesn't like. Sorry I can't elaborate on that, email server
>> setups
>> are often something of a mystery!
>>
>> Have a look at this page on my support section:
>>
>> https://formtoemail.com/developersupport/not_receiving_email.php
>>
>> It wouldn't do any harm to try the -f parameter or the ini_set for
>> sendmail_from.
>>
>> (sure you entered the Hotmail address correctly?)
>>
>> Any questions, just let me know.
>>
>> Best wishes.
>>
>> Charles Sweeney
>> https://formtoemail.com
>> The world's easiest feedback script!
>>
>> ----- Original Message -----
>> Sent: Tuesday, August 05, 2008 11:35 PM
>> Subject: Re: FormToEmail script
>>
>>
>>> one final question Charles,
>>>
>>> My form will not send to my "MSN hotmail account" but will send to other
>>> email accounts (that are operated by "webmail" or mail that has a C
>>> panel
>>> attached to it)- do you know of any reason why ?
>>>
>>> Thanks alot Charles

>>>> Hi
>>>>
>>>> No trouble at all.
>>>>
>>>> I'm in the UK but I'm so busy with my current work that I don't do
>>>> custom
>>>> work!
>>>>
>>>> Best wishes.
>>>>
>>>> Charles Sweeney
>>>> https://formtoemail.com
>>>> The world's easiest feedback script!
>>>>
>>>> ----- Original Message -----
>>>> Sent: Tuesday, August 05, 2008 10:01 PM
>>>> Subject: Re: FormToEmail script
>>>>
>>>>
>>>>>
>>>>> sorry Charles false alarm
>>>>> I forgot to add "array" (first word of code you gave me) - much
>>>>> appreciated.
>>>>>
>>>>> Can you tell me where you are located, your specialties, areas of
>>>>> interest, educational background and what you charge for your services
>>>>> ???
>>>>> I am looking for a web guy that doesn't know the word "impossible" and
>>>>> can
>>>>> trouble shoot, optimize in the future, etc, etc.. Thanks alot.
>>>>>
>>>>>
>>>>>> Hi
>>>>>>
>>>>>> I did read your first email. Interpretation isn't always
>>>>>> straight-forward.
>>>>>>
>>>>>> You can still use the code in that page I gave you.
>>>>>>
>>>>>> On each form, put a hidden input, like this:
>>>>>>
>>>>>> <input type="hidden" name="recipient" value="recipient_1">
>>>>>>
>>>>>> The next form would have this:
>>>>>>
>>>>>> <input type="hidden" name="recipient" value="recipient_2">
>>>>>>
>>>>>> Using a different value for each form (recipient_1, recipient_2,
>>>>>> recipient_3
>>>>>> etc).
>>>>>>
>>>>>> Then in the script, locate this line:
>>>>>>
>>>>>> mail($my_email,$subject,$message,$headers);
>>>>>>
>>>>>> Above it, put this code:
>>>>>>
>>>>>> $recipients = array(
>>>>>>
>>>>>> 'recipient_1' => '[email protected]',
>>>>>> 'recipient_2' => '[email protected]',
>>>>>> 'recipient_3' => '[email protected]'
>>>>>>
>>>>>> );
>>>>>>
>>>>>> $my_email = $recipients[$_REQUEST['recipient']];
>>>>>>
>>>>>> You can do this with the free script (note that there is not a comma
>>>>>> at
>>>>>> the
>>>>>> end of the last email address in the list).
>>>>>>
>>>>>> This means you only need one script to process all the forms,
>>>>>> providing
>>>>>> you
>>>>>> have all the email addresses in it matching all the forms.
>>>>>>
>>>>>> Any questions, just let me know.
>>>>>>
>>>>>> Best wishes.
>>>>>>
>>>>>> Charles Sweeney
>>>>>> https://formtoemail.com
>>>>>> The world's easiest feedback script!
>>>>>>
>>>>>> ----- Original Message -----
>>>>>> Sent: Tuesday, August 05, 2008 6:51 PM
>>>>>> Subject: FormToEmail script
>>>>>>
>>>>>>
>>>>>>>
>>>>>>> Comments: email number 2- I just read your info about a "dropdown
>>>>>>> list"
>>>>>>> of
>>>>>>> different recipients. I prefer for the visitor to just fill out
>>>>>>> contact
>>>>>>> form - I will make individual contact forms for EACH counsellor
>>>>>>> (same
>>>>>>> information but different email address of course) thanks again.
>>>>>>> (
>>>>>>> see recent first email I sent for details of questions)