sending form submitted emails via a wamp server

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

Post 3+ Months Ago

hi there

i have been reading various thread about sending emails on the wamp server but none have actually addressed the criteria of using a username and password.

i have successfully installed wamp and am able to submit forms to my database. i have edited my php.ini file to include the smtp coding. i do not know where to put the username and password as this is definately needed for me to send emails. it is a requirement of the server i am using. it wont cooperate unless. my question is where do i put the username and password?

this is the insert into database:
Code: [ Select ]
$query = "INSERT INTO partybookingform (pgname, address, postcode, homecontactnum, mobilecontactnum, emailaddress, birthdaychildname, childbirthday, partytype, price, dateofparty, numofpartyguests, additionalnotes) VALUES ('$pgname', '$address', '$postcode', '$homecontactnum', '$mobilecontactnum', '$emailaddress', '$birthdaychildname', '$childbirthday', '$partytype', '$price', '$dateofparty', '$numofpartyguests', '$additionalnotes')";
mysql_query($query) or die(mysql_error());
  1. $query = "INSERT INTO partybookingform (pgname, address, postcode, homecontactnum, mobilecontactnum, emailaddress, birthdaychildname, childbirthday, partytype, price, dateofparty, numofpartyguests, additionalnotes) VALUES ('$pgname', '$address', '$postcode', '$homecontactnum', '$mobilecontactnum', '$emailaddress', '$birthdaychildname', '$childbirthday', '$partytype', '$price', '$dateofparty', '$numofpartyguests', '$additionalnotes')";
  2. mysql_query($query) or die(mysql_error());

the last code snippet i used was this:
Code: [ Select ]
$smtp_server = "192.6.1.4";
$port = 25;
$mydomain = "dcobbinah.co.uk";
$username = "username"; // MS Exchange servers will probably require a valid NT domain name as part of the username. E.g., "ntdomain\user"
$password = "password";
$sender = "$emailaddress";
$recipient = "dcobbinah@hamleys.co.uk";
$subject = "test";
$content = "This is what you submitted:\n\n\nParent or Guardian Name: ".($_POST['pgname'])."\nAddress: ".($_POST['address'])."\nPost Code: ".($_POST['postcode'])."\n\nHome Contact Number: ".($_POST['homecontactnum'])."\n\nMobile Number: ".($_POST['mobilecontactnum'])."\n\nEmail Address: ".($_POST['emailaddress'])."\n\nBirthday Child's Name: ".($_POST['birthdaychildname'])."\n\nChild's Birthday: ".($_POST['childbirthday'])."\n\nType Of Party: ".($_POST['partytype'])." \n\nPrice".($_POST['price'])."\n\nDate Of Party: ".($_POST['dateofparty'])."\n\nNumber of Guests: ".($_POST['numofpartyguests'])." \n\nAny Additional Notes: ".($_POST['additionalnotes'])."\n\n\n\nRegards,\n\n\nDanny";

// 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 = "192.6.1.4";
  2. $port = 25;
  3. $mydomain = "dcobbinah.co.uk";
  4. $username = "username"; // MS Exchange servers will probably require a valid NT domain name as part of the username. E.g., "ntdomain\user"
  5. $password = "password";
  6. $sender = "$emailaddress";
  7. $recipient = "dcobbinah@hamleys.co.uk";
  8. $subject = "test";
  9. $content = "This is what you submitted:\n\n\nParent or Guardian Name: ".($_POST['pgname'])."\nAddress: ".($_POST['address'])."\nPost Code: ".($_POST['postcode'])."\n\nHome Contact Number: ".($_POST['homecontactnum'])."\n\nMobile Number: ".($_POST['mobilecontactnum'])."\n\nEmail Address: ".($_POST['emailaddress'])."\n\nBirthday Child's Name: ".($_POST['birthdaychildname'])."\n\nChild's Birthday: ".($_POST['childbirthday'])."\n\nType Of Party: ".($_POST['partytype'])." \n\nPrice".($_POST['price'])."\n\nDate Of Party: ".($_POST['dateofparty'])."\n\nNumber of Guests: ".($_POST['numofpartyguests'])." \n\nAny Additional Notes: ".($_POST['additionalnotes'])."\n\n\n\nRegards,\n\n\nDanny";
  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");


this particular code is not working at all. it is not sending any emails to the sender at all, it is submitting to the database which is great. any help on this please?
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

Post Information

  • Total Posts in this topic: 1 post
  • Users browsing this forum: No registered users and 64 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.