Portal Home > Knowledgebase > Articles Database > Need help with newsletter script


Need help with newsletter script




Posted by SuperZ, 08-06-2010, 10:16 AM
Hi, I currentlly have a client of mine who has a asp script and i'm only running on linux, so i need to change this script over to PHP or something. START OF HTML CODING

Register here for Newsletter

Email: 

Your email will be stored by website.com
only and will not be forwarded to any third parties.
############ END OF HTML CODING ################# START OF ASP CODING <% MailServer = "mail.website.com" emailTo = "user@website.com" emailFrom = """The Website"" " fullSubject = "Newsletter Registration from Website - Add to Database" redirectPage = "thanks_register.html" 'For Each I In Request.Form variables = variables & "Email" & " : " & Request.Form("Email") & "
" & vbCrLf 'Next strBody = "" & variables & "" ' and now mail it */ Set objCDOMail = Server.CreateObject("CDO.Message") Set objCDOSYSCon = Server.CreateObject ("CDO.Configuration") objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = MailServer objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 objCDOSYSCon.Fields.Update Set objCDOMail.Configuration = objCDOSYSCon FullSubject = "Newsletter Registration from Website - Add to Database" objCDOMail.From = emailFrom objCDOMail.To = emailTo ' objCDOMail.Cc = "" ' objCDOMail.Bcc = "" objCDOMail.Subject = fullSubject objCDOMail.HTMLBody = strBody objCDOMail.Send Set objCDOMail = Nothing ' now show the thank you page Response.Redirect redirectPage %> ############ END OF ASP CODING ################# this works fine on his old servers, but i need it to work on my server, any ideas with PHP?

Posted by SuperZ, 08-06-2010, 10:20 AM
I've tried to edit a PHP script I know that works, but its comes up with an error on line 12 - parse error T_STRING "; $msg = "Subject : Newsletter Registration from Website - Add to Database"; $msg .= "E-Mail:\t$Email\n"; //send the message $success=mail($to, $enquiry, $msg, $mailheaders); //if successfull, we redirect to success page if ($success) { $redirect="../$result"; header("Location: $redirect"); exit; } else { echo "Send of Message Failed!"; } } else { echo "MAIL SCRIPT FAILED AS NO MESSAGE VARIBLES WHERE DETECTED!!"; } ?>

Posted by SuperZ, 08-06-2010, 11:57 AM
In essence, its not really a newsletter. Its kind of just an email contact form but with just the email address and nothing else. Any ideas

Posted by NewFound, 08-06-2010, 01:19 PM
Well I can see already this line here will give you some errors. you are closing the String after From:, The website isnt in a string, then is again but they arent even concated...so it wouldn't work anyhow. Try $mailheaders="From: ".$websiteVar."Other text here";

Posted by SuperZ, 08-11-2010, 07:55 AM
OK, now I've got another php script and just tried to pump it up abit; "; $msg = "Subject : Contact Form from Website"; $msg .= "Name:\t$Name \n"; $msg .= "E-Mail:\t$Email\n"; $msg .= "Telephone:\t$Telephone\n"; $msg .= "$Message\n\n"; //send the message $success=mail($to, $enquiry, $msg, $mailheaders); //if successfull, we redirect to success page if ($success) { $redirect="../$result"; header("Location: http://domain.com/thanks.html"); exit; } else { echo "Send of Message Failed!"; } } else { echo "MAIL SCRIPT FAILED AS NO MESSAGE VARIBLES WHERE DETECTED!!"; } ?> It now comes up with an error on line 16? any ideas?

Posted by SuperZ, 11-03-2010, 12:57 PM
I'm using the first script that i mentioned and now it comes up with a "MAIL SCRIPT FAILED AS NO MESSAGE VARIBLES WHERE DETECTED!!" Anyone with any ideas on this?



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read
Drupal versus Joomla (Views: 798)


Language:

LoadingRetrieving latest tweet...

Back to Top Copyright © 2018 DC International LLC. - All Rights Reserved.