Link to home
Create AccountLog in
Avatar of MarleneAyers
MarleneAyers

asked on

php email form host server requires smtp authorization

My client wants to have site visitors to be able to go to the site and at end of story jave a link that sends an emil to their state senator showing support for an upcoming proposal. I am using a php page and I know how to do a simple mailto link but not sure how to have a preaddressed subject and message as well. Alos my host company requires smtp authorization. NOt clear how to accomnodate that.
ASKER CERTIFIED SOLUTION
Avatar of tg_wilk
tg_wilk

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Avatar of MarleneAyers
MarleneAyers

ASKER

Thank you for your help! I think that attached code is the code I want to use but not sure about a few things. The visitor would click on a link for the home page that would take them to a page that would ask them for their first and last name. Then they click on a button that says show me letter which takes them to another page where  I want them to be able to see the letter nicely formatted  with their name as it will be seen by the recipient. Do I use regular html to do this? Is there any way to combine asking for their first and last name and the email on the same page rather than have the user go to two separate pages? At that point the visitor should have the option to cancel or send. Can I also blind copy another email address?


<?php
$Fname = $_POST["Fname"];
$Lname = $_POST["Lname"];?>
 
 
<?php $contents = " August 6, 2008
 
City Council Member
275 E. Olive Avenue
P.O. Box 6459
Burbank, CA  91510
Email:  citycouncil@ci.burbank.ca.us
Dear City Council Member,
 
I am writing in support of the Burbank Community YMCA.  I know there is a proposal pending asking the City Council to grant a loan to the YMCA to enable the purchase property on San Jose Avenue.  This property would then be converted into additional parking spaces for the YMCA, alleviating the current parking shortfall and related safety issues.
 
I urge you to grant the Burbank Community YMCAs full request. Doing so would be in the best interest of supporting the long term health of this organization and the Burbank Community YMCA.  Please vote YES to grant this loan.
 
Respectfully,
 
$Fname." ".$Lname
 
Burbank Resident";
$to = "Youremailaddress";
$from_header = "From: Senderemailaddress";
if($contents != "")
{
   //send mail - $subject & $contents come from surfer input
   mail($to, $subject, $contents, $from_header);
   // redirect back to url visitor came from
  
}
  else
{
   print("<HTML><BODY>Error, no comments were submitted!");
   print("</BODY></HTML>");
}
 
?>

Open in new window

HI MarleneAyers
I thought you excepted the question before!!!

anyway

Give me some time, i will sent you modified code unless some one help you before that

thanks
Is there any way to combine asking for their first and last name and the email on the same page rather than have the user go to two separate pages?  

yes you can do that , instead of 2 pages.

the code you submitted here, with letter head,
if you try that code, what happended ?? does it work ??

You might need little bit of extra html code to build up nice looking leter head

There is a follow-up question. I did not know the best way to ask a follow up so I posted as another question.