sending a form using php on windows server

  • buzzby
  • Novice
  • Novice
  • buzzby
  • Posts: 25

Post 3+ Months Ago

i would like some help please in sending the data of a form to an email address. i have the form submitting to a database. i also want the form info sent to an email address. the problem is that i am on a windows server using wamp. from resaearch i gather i have to put a username and password somewhere for the mail to be sent as this is whats required. i am not sure where to put this information. also the username and pasword of what exactly? i have gone into the php.ini file and edited the lines that pertain to sending mail. i have class.phpmailer.php and mail.in.php all in place. each time i fill out the form it populates the database but does not send the email.

any help please

this is my code to send the contents of the form in an email

Code: [ Select ]
$mail = new MyMailer;
$yourEmail = 'danny@dcobbinah.co.uk';
$mail->AddAddress($_POST['email'].",$yourEmail");
$mail->Subject = "Thank you";
$mail->Body = "This is what you submitted:\n\n\nOrganisation Name: ".($_POST['name'])."\nAddress: ".($_POST['address'])."\nTelephone Number: ".($_POST['pcode'])."\n\nEmail Address: ".($_POST['email'])."\n\nDate of party: ".($_POST['terms'])."/".($_POST['specialoffers'])."/".($_POST['newsletter'])." \n\n\n\nRegards,\n\n\nMEEEE";
//$mail->AddAttachment("buildingdoctorsbrochure.zip", "buildingdoctorsbrochure.zip"); // optional name

if(!$mail->Send())
{
echo "There was an error sending the message";
exit;
}
  1. $mail = new MyMailer;
  2. $yourEmail = 'danny@dcobbinah.co.uk';
  3. $mail->AddAddress($_POST['email'].",$yourEmail");
  4. $mail->Subject = "Thank you";
  5. $mail->Body = "This is what you submitted:\n\n\nOrganisation Name: ".($_POST['name'])."\nAddress: ".($_POST['address'])."\nTelephone Number: ".($_POST['pcode'])."\n\nEmail Address: ".($_POST['email'])."\n\nDate of party: ".($_POST['terms'])."/".($_POST['specialoffers'])."/".($_POST['newsletter'])." \n\n\n\nRegards,\n\n\nMEEEE";
  6. //$mail->AddAttachment("buildingdoctorsbrochure.zip", "buildingdoctorsbrochure.zip"); // optional name
  7. if(!$mail->Send())
  8. {
  9. echo "There was an error sending the message";
  10. exit;
  11. }
  • buzzby
  • Novice
  • Novice
  • buzzby
  • Posts: 25

Post 3+ Months Ago

[mail funtion]
SMTP = localhost
smtp_port = 25

what am i supposed to do after that? username and password? should i be using smtp or sendmail?
  • buzzby
  • Novice
  • Novice
  • buzzby
  • Posts: 25

Post 3+ Months Ago

if i use sendmail being sendmail_from = danny@dmcobbinah.co.uk where do i put the username and password?

i came across this code and was toild it works but it doesnt

Code: [ Select ]
$smtp_server = "255.255.255.255";
$port = 25;
$mydomain = "me.co.uk";
$username = "user"; // MS Exchange servers will probably require a valid NT domain name as part of the username. E.g., "ntdomain\user"
$password = "pass";
$sender = "$emailaddress";
$recipient = "anyone@dmcobbinah.co.uk";
$subject = "test";
$content = "This is what you submitted:\n\n\nOrganisation Name: ".($_POST['firsname'])."\nAddress: ".($_POST['houseflat'])."\nTelephone Number: ".($_POST['pcode'])."\n\nEmail Address: ".($_POST['email'])."\n\nDate of party: ".($_POST['terms'])."/".($_POST['specialoffers'])."/".($_POST['newsletter'])." \n\n\n\nRegards,\n\n\nHAMLEYS";

// Initiate connection with the SMTP server
$handle = fsockopen($smtp_server,$port);
fputs($handle, "EHLO $mydomain\r\n");

// SMTP authorization
fputs($handle, "AUTH LOGIN\r\n");
fputs($handle, base64_encode($username)."\r\n");
fputs($handle, base64_encode($password)."\r\n");

// Send out the e-mail
fputs($handle, "MAIL FROM:<$sender>\r\n");
fputs($handle, "RCPT TO:<$recipient>\r\n");
fputs($handle, "DATA\r\n");
fputs($handle, "To: $recipient\n");
fputs($handle, "Subject: $subject\n\n");
fputs($handle, "$content\r\n");
fputs($handle, ".\r\n");

// Close connection to SMTP server
fputs($handle, "QUIT\r\n");
  1. $smtp_server = "255.255.255.255";
  2. $port = 25;
  3. $mydomain = "me.co.uk";
  4. $username = "user"; // MS Exchange servers will probably require a valid NT domain name as part of the username. E.g., "ntdomain\user"
  5. $password = "pass";
  6. $sender = "$emailaddress";
  7. $recipient = "anyone@dmcobbinah.co.uk";
  8. $subject = "test";
  9. $content = "This is what you submitted:\n\n\nOrganisation Name: ".($_POST['firsname'])."\nAddress: ".($_POST['houseflat'])."\nTelephone Number: ".($_POST['pcode'])."\n\nEmail Address: ".($_POST['email'])."\n\nDate of party: ".($_POST['terms'])."/".($_POST['specialoffers'])."/".($_POST['newsletter'])." \n\n\n\nRegards,\n\n\nHAMLEYS";
  10. // Initiate connection with the SMTP server
  11. $handle = fsockopen($smtp_server,$port);
  12. fputs($handle, "EHLO $mydomain\r\n");
  13. // SMTP authorization
  14. fputs($handle, "AUTH LOGIN\r\n");
  15. fputs($handle, base64_encode($username)."\r\n");
  16. fputs($handle, base64_encode($password)."\r\n");
  17. // Send out the e-mail
  18. fputs($handle, "MAIL FROM:<$sender>\r\n");
  19. fputs($handle, "RCPT TO:<$recipient>\r\n");
  20. fputs($handle, "DATA\r\n");
  21. fputs($handle, "To: $recipient\n");
  22. fputs($handle, "Subject: $subject\n\n");
  23. fputs($handle, "$content\r\n");
  24. fputs($handle, ".\r\n");
  25. // Close connection to SMTP server
  26. fputs($handle, "QUIT\r\n");

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 67 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.