PHP - Php Mail() ... Dont Work With My New Server
Hello,
im using a contact form which sends me an email with the data name.. comments .. Now im testing a new better server which use IMAP (old POP3) and my form is not working like it used to be.. Code: [Select] $emailTo = " $dbSentEmail"; //Put your own email address here $emailServer = "noreply@totalsports.com.cy"; //Put your own email address here $body = "Name: $name \n\nEmail: $email \n\nSubject: $subject \n\nComments:\n $comments"; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/plain; charset=UTF-8' . "\r\n"; $headers .= 'From: Contact Form <'.$emailServer.'>' . "\r\n" . 'Reply-To: ' . $email; mail($emailTo, $subject, $body, $headers); Any idea what i have to do to work like before? Similar TutorialsThis topic has been moved to Other Web Server Software. http://www.phpfreaks.com/forums/index.php?topic=347009.0 $to=sammieave@ave.com,samuel@ave.com; $subject = "New Event Logged"; $message = "Test"; $headers = "From: Samuel<sammieave@ave.com>;\r\n"; $headers .= "Content-Type: text/html"; mail($to,$subject,$message,$headers); I am having the above code but unfortunately the error I am getting is: Warning: mail() [function.mail]: SMTP server response: 550 Requested action not taken: mailbox unavailable or not local in C:\xampp\htdocs\CRM\support\mailer.php on line 139 Hello! i am new to php. I need help to get all the displayed information in the mail, see below. I dont get the phone information. Thanks in adwansed <?php // anger en variabel som kan lagra de eventuella felaktigheterna $errors = array(); // kontrollera om ett Förnamn angivits if (!$_POST["namn"]) $errors[] = "- NAMN"; // kontrollera om ett TELEFONNUMMER angivits if (!$_POST["phone"]) $errors[] = "- TELEFONNUMMER"; // kontrollera om ett TELEFONNUMMER angivits $emailcheck = $_POST["email"]; if(!preg_match("/^[a-z0-9\å\ä\ö._-]+@[a-z0-9\å\ä\ö.-]+\.[a-z]{2,6}$/i", $emailcheck)) $errors[] = "- din E-POSTADRESS saknas eller är felaktig"; // kontrollera om ett Meddelande angivits if (!$_POST["message"]) $errors[] = "- inget MEDDELANDE har skrivits!"; if (count($errors)>0){ echo "<h1>Felmeddelande:</h1> <strong>Följande information måste anges innan du kan skicka formuläret:</strong><br /><br> "; foreach($errors as $fel) echo "$fel <br />"; echo "<br />Ange den information som saknas och skicka formuläret igen. Tack! <br />"; echo "<a href='javascript:history.go(-1)'>klicka här för att komma tillbaka till formuläret</a>"; } else { // formuläret är korrekt ifyllt och informationen bearbetas $to = "mailo@mail.com"; $from = $_POST["email"]; $subject = 'Kontakt från webbplatsen!'; $namn = $_POST["namn"]; $phone = $_POST["phone"]; $message = $_POST["message"]; ######################################################################## // HEADERS för innehållstyp och textkodning $headers = "Content-Type: text/plain; charset=utf-8 \r\n"; $headers .= "From:".$namn." <".$from.">"."\r\n"; $headers .= "MIME-Version: 1.0 \r\n"; ######################################################################## // Mailfunktionen som skickar bekräftelsen if (mail($to, $subject, $message, $headers)) echo nl2br("<h2>Tack $namn! Ditt meddelande har skickats!</h2> //###I WANT ALL THIS IN THE MAIL### <b>Mottaga </b> $to <b>Namn:</b> $namn <b>E-Mail:</b> $from <b>Telefonnummer:</b> $phone <b>meddelande:</b> <br/>$message "); else echo "Det gick inte att skicka ditt meddelande"; } ?>
why this simple code only works on chrome??
function mostrarOcultar(obj) { document.getElementById('seguro').style.visibility = (obj.checked) ? 'hidden' : 'visible'; } hi every one i want to make a list from my database and if user click on one item it open a link... its a list of models of products so if click in one link me to the page of its full description, my database has the fields: "modelo" (model), and "paginal" the link page i make this code.. works fine cause display all the catalog but when i click in an item dont do nothing... hes the code.. what im missing?? tnx in advance <?PHP // Connect to MySQL Server @mysql_connect('localhost','user','password') or DIE("Couldn't Connect to MySQL Database"); // Select Database @mysql_select_db('zerocctv_almacen') or DIE("Couldn't Select Database"); $sql = "SELECT modelo, paginal,precio,foto FROM modelos"; $result=mysql_query($sql); $row_array=mysql_fetch_row($result); $string='<select name=selection><option value=>modelo</option>'; for ($i=0;$i < mysql_num_rows($result);$i++) { if ($row_array[0]=="") { $row_array=mysql_fetch_row($result); } else { $string .='<option value="'.$row_array[1].'">'.$row_array[0]."</option>"; $row_array=mysql_fetch_row($result); } } $string .='</SELECT>'; //echo "</label>"; echo $string; ?> Hi.., I use below method to export data to excel. header('Content-type: application/ms-excel'); header('Content-Disposition: attachment; filename=abc.xls'); if I run the script from the server. (http://localhost/export.php) it is work. (pop-up window if i want save or open the file) but if i run the script from the client (http://192.168.1.5/export.php) it is not work. (nothing happen) any idea how to solve this? Say I have an email info@website.com created in cPanel on a web hosting company. I want to send email notifications to users on my website. I am using PHP Mailer to send the emails. But all the emails go directly into their junk box/spam folder, unless they confirm that info@website.com is not junk. I am wondering if there is a work around for this? Hello i m newbie to PHP. I am trying to host the website on my laptop but due to some configuration i cant send the emails through php script. I am trying send mail through mail() but not able to sent mail. heres the code: $to = "jwalant.baria@gmail.com"; $subject = "Hi!"; $body = "Hi,\n\nHow are you?"; if (mail($to, $subject, $body)) { echo("<p>Message successfully sent!</p>"); } else { echo("<p>Message delivery failed...</p>"); } Output: Message delivery failed.. I read the previous post here. but I am not able to figure out what to do about it. Can anyone tell me what setting i do in my php.ini? or any other that necessary settings require for this. i don't have SMTP server on my laptop so is there any method from which i can setup the SMTP server on laptop.? I use apache HTTP 2.2 and PHP 5.3.4 Rest of the website working correctly but only mail not working. TY..!! Hi, I am having a problem with my Website mail. Basically the mail was working fine yesterday but last night I edited the PHP script slightly because for some reason the page that it was directed to had gone missing and was turning up an 404 error, which was just a newsuince as the email was still sent. So I just edited it so that it echo'ed a message saying thanks. but is seems today the mail is not getting to its destination. The PHP returns no errors and returns the success message fine but after saying its been sent it never appears. I have tried different email addresses on different servers and that was no use and I have also changed the code back to how it was yesterday. and it still doesn't work. I have also put the page up on one of my other sites which I know everything is set up properly and it works fine, making me think that it is a mail setup issue. but as I did not set up the mail at all and quite frankly don't really understand it, I don't know how it is meant to be set up as I just use google apps for sites that I set up. So yeah I am trying to work out what could have gone wrong since yesterday but I don't really understand it, below is the code as it as now and as it was yesterday: Code: [Select] <?php $EmailFrom = "johnshale@hotmail.co.uk"; $EmailTo = "matthale.live@gmail.com"; $Subject = "Website enquiry"; $Name = Trim(stripslashes($_POST['Name'])); $Tel = Trim(stripslashes($_POST['Tel'])); $Email = Trim(stripslashes($_POST['Email'])); $Message = Trim(stripslashes($_POST['Message'])); // validation $validationOK=true; if (!$validationOK) { print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">"; exit; } // prepare email body text $Body = ""; $Body .= "Name: "; $Body .= $Name; $Body .= "\n"; $Body .= "Tel: "; $Body .= $Tel; $Body .= "\n"; $Body .= "Email: "; $Body .= $Email; $Body .= "\n"; $Body .= "Message: "; $Body .= $Message; $Body .= "\n"; // send email $success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>"); // redirect to success page if ($success){ print "<meta http-equiv=\"refresh\" content=\"0;URL=contactthanks.php\">"; } else{ print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">"; } ?> and the page is at www.sullyco.co.uk/contactengine.php as you can see the page is redirecting to a page that does not exist(contactthanks.php) indicating that the message was sent successfully. it is also the part I edited as a quick fix last night I just got it to echo a success message. Thanks for any help on this, I have been trying to work it out all morning, Matt Hi, I want to read multipart messages. If i send a mail from Gmail or yahoo, the body of the message is not read properly. I also want to read all the messages properly. Can someone give me the code for it? I am developing an email application for the first time. Thanks Raja Hi, I have Code: [Select] $to = 'rberbe2002@msn.com'; $subject = 'the subject'; $message = 'hello'; $headers = 'From: webmaster@example.com'; mail($to, $subject, $message, $headers); which works fine on a shared hosting website I have, but not on a website I have on my dedicated server. Any ideas or suggestions please? Hi. I am sending out email with a php script - about 5000 at a time by send 15 or so every 20 seconds which works fine. Sometimes I need to add an attachemnt. I then find that the script will keep stalling. Is there a way to test the server qmail/mail queue to see if it isready to send another message? - rather than send it and have the script stall? It may be enough to simply be able to check that the number of messages left to be sent in the queue? Have search a lot for help on this with no results. Any server/qmail experts out there? Thanks Paul well.. i have vbulletin 4 forum i try to put video player so if i upload mp4 file so i can play video but sad part is its working only at firefox browser can you help me out .. video code looks like this
<vb:if condition="$attachment[attachmentextension] == mp4"> pls i really want that put to work in every browser sadly it works only in firefox somehow.. I am having an issue with a support ticket program. I have added a feature to this program that allows my staff members to add multiple users to a ticket. The problem I am having because I am new to PHP is how do I email the users when they have been added to the ticket. Below is the code I am using for add user. If someone could look at it and help me figure out how to get this to email the user when they are added to the support ticket that would be great. I have been struggling with this for alot of nights and just cant figure it out. Code: [Select] <?php require "../conf/conn.php"; require "../conf/conf.php"; require "session.php"; ?> <html> <head> <title><?php echo "$c_title - Add User"; ?></title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <STYLE type="text/css"> <?php include('../style.php'); ?> </STYLE> <SCRIPT LANGUAGE="JavaScript"> <!-- Begin function dele(assigned_user,username,ticket_id,id) { var assigned = document.getElementById('assigned_user').value; if(assigned_user==assigned) { alert("You Can't Delete the user '"+username+"'\nUsername assigned for the ticket '"+ticket_id+"'"); } else { if(confirm('Are you sure to delete?')) window.location.href = "adduser.php?action=delete&user_id="+assigned_user+"&ticket_id="+ticket_id+"&ticid="+id; } } // End --> </script> </head> <body> <?php $ticket_id = $_GET['ticket_id']; if(isset($_GET['action'])) { if($_GET['action']=='delete'){ if(isset($_GET['ticid'])) { $tid = $_GET['ticid']; $query_user ="DELETE FROM support_users WHERE id='$tid'"; $result=mysql_query($query_user); echo $_SESSION['successMsg'] = "<b>User Deleted From the ticket '$ticket_id'</b>"; } } } if(!empty($_POST)) { $date = date('Y-m-d H:i:s'); $puid = $_POST['username']; if($puid!='') { mysql_query("INSERT INTO support_users (id,user_id,ticket_id,assign_date) VALUES ('','$puid','$ticket_id','$date')") or die("<B>Error ".mysql_errno()." :</B> ".mysql_error().""); $_SESSION['successMsg'] = "User Added !"; } } $query_user ="SELECT SU.id,SU.user_id,SU.ticket_id,SU.assign_date,U.user,U.name,U.email FROM support_users AS SU LEFT JOIN users AS U ON SU.user_id=U.id WHERE ticket_id='$ticket_id';"; $result1=mysql_query($query_user); $user_arr = array(); while($userrow1 = mysql_fetch_array($result1)) { $user_arr[] = $userrow1['user_id']; } $result=mysql_query($query_user); $query_user ="SELECT * FROM support WHERE Ticket='$ticket_id';"; $support_result=mysql_query($query_user); $support = mysql_fetch_array($support_result); /* $query_user ="SELECT * FROM users WHERE Ticket='$ticket_id';"; $support_result=mysql_query($query_user); $support = mysql_fetch_array($support_result);*/ if(isset($_SESSION['successMsg'])) { if($_SESSION['successMsg']=="") { echo $_SESSION['successMsg']; $_SESSION['successMsg'] = ""; } } ?> <form method="post" action=""> <table width="400" border="0" align="center" cellspacing="1"> <tr> <td colspan="4" class="submenu"> Ticket ID <?=$ticket_id?> </td> </tr> <tr align="center"> <td colspan="4" class="submenu"> Add Users </td> </tr> <tr align="center"> <td class=""> Select User </td> <td> <select name="username"> <option value="">[--Select User--]</option> <?php $query_user1 ="SELECT * FROM users WHERE level = '3' AND active <> '0' AND validated ='1' order by name"; $result1=mysql_query($query_user1); while($userrow1 = mysql_fetch_array($result1)) { if(!in_array($userrow1["id"],$user_arr)) { $tempuser=$userrow1["user"]; ?> <option value="<?php echo $userrow1["id"];?>"<?php if($row_user[user]==$tempuser){echo " selected ";}?>><?php echo "$userrow1[user] ($userrow1[name] )"; ?></option> <?php } } ?> </select> <input type='submit' value='Add'> </td> </tr> </table> </form> <table width="400" border="0" cellspacing="0" cellpadding="0" align="center" class="border"> <tr> <td> <table width="400" border="0" align="center" cellspacing="1"> <tr align="center"> <td colspan="4" class="submenu"> Assigned Users <input type='hidden' id='assigned_user' name='assigned_user' value="<?=$support['user_id']?>"> </td> </tr> <tr> <td class="descrip">User</td> <td class="descrip">Name</td> <td class="descrip">Email</td> <td class="descrip">Actions</td> </tr> <?php while($row = mysql_fetch_array($result)) { ?> <tr> <td class="dat"><a href="#" onClick="sendValue(<?php echo "'".$row[user]."'"; ?>);"><?php echo $row[user]; ?></a><?php if ($row["active"] == 2) echo "<font size=1 color=#FF0000> (Suspended)</font>"; ?></td> <td class="dat"><?php echo $row["name"]; ?></td> <td class="dat"><?php echo $row["email"]; ?></td> <td class="dat"><img src="../images/delete3.gif" /> <a href="javascript:dele('<?=$row["user_id"]?>','<?=$row["user"]?>','<?=$row["ticket_id"]?>','<?=$row["id"]?>');">Delete </a></td> </tr> <?php } ?> <tr align="center"> <td colspan="4" class="submenu"> <?php if ($numpage>1) { pagenav(); } else { echo " "; } ?> </td> </tr> </table> </td> </tr> </table> <br><table align="center"><tr><td><a href="javascript:window.close();">Close Window</a></td></tr></table> </body> </html> Thanks in advance for any help... I have this code as my session_init.php Code: [Select] <?php $_SESSION['APP_MX'] = "mail.mywebsite.com"; $_SESSION['APP_SERVER'] = "mywebsite.com"; $_SESSION['SITE_EMAIL'] = "admin@mywebsite.com"; $_SESSION['MYSQL_SERVER1'] = "localhost"; $_SESSION['MYSQL_LOGIN1'] = "root"; $_SESSION['MYSQL_PASS1'] = "password"; $_SESSION['MYSQL_DB1'] = "sample"; $_SESSION['LOGGEDIN'] = ""; $_SESSION['USERID'] = 0; $_SESSION['EMAIL'] = ""; $_SESSION['FNAME'] = ""; $_SESSION['LNAME'] = ""; $_SESSION['SESSION'] = true; ?> and I'm calling it here Code: [Select] <?php if(!isset($_SESSION['SESSION'])) require('../email/session_init.php'); $fname = $_POST["fname"]; $lname = $_POST["lname"]; $email= $_POST["email"]; $company = $_POST["company"]; $subject = $_POST["subject"]; $phone = $_POST["phone"]; $msg = $_POST["msg"]; $mail = "Hello $fname,\n\nThank your for your email.\nWe look forward to your evaluation of our product.\n\n"; $mail .= "Here is the information you have given us:\n\n"; $mail .= "Name: ".$fname." ".$lname."\n"; $mail .= "Company: ".$company."\n"; $mail .= "Email Address: ".$email."\n"; $mail .= "Phone: ".$phone."\n\n"; $mail .= "Subject: ".$subject."\n"; $mail .= "Your Message:\n".$msg."\n\n\n"; $mail .= "Best Regards,\nCustomer Service\n\n"; // If any lines are larger than 70 characters, we will use wordwrap() $message = wordwrap($msg, 70); mail($email, $subject, $mail, "From: admin@".$_SESSION['APP_SERVER']."\r\n"); $mail = str_replace("\n", "<br>", $mail); ?> And I'm getting this error Quote Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 26, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\wamp\www\php\website_interactivity\email\email_sent.php on line 33 I wonder if there's any modification that I need to do in my php.ini file. Anyone? well, i have a hosting site and i enter via cpanel,(just in case it matters) and i am trying to use the mai() function but it won't work.. :S this is my code Code: [Select] <?php $to = "pato.llaguno@gmail.com"; $subject = "Hi!"; $body = "Hi,\n\nHow are you?"; if (mail($to, $subject, $body)) { echo("<p>Message successfully sent!</p>"); } else { echo("<p>Message delivery failed...</p>"); } ?> the output is Message successfully sent! but i don't get any mail in the adress specified :S I know there has got to be some server config somewhere. But I have a site with about 8000 users. And 20% or so can never receive "forgot email" passwords. A lot of them checked their junk and its not there, it just never gets delivered. But for a lot of people it works fine. So... How can i get PHP mail() to work better. Right now im using swift mailer with this code Code: [Select] function email($to,$subject,$body,$from="") { require_once 'packages/swift/swift_required.php'; $transport = Swift_SendmailTransport::newInstance('/usr/sbin/sendmail -bs'); $mailer = Swift_Mailer::newInstance($transport); $message = Swift_Message::newInstance($subject); $message->setFrom($from); $headers = $message->getHeaders(); if (!$headers->has('Reply-To')) { $headers->addTextHeader('Reply-To',$from); } if(!is_array($to)) $to = array($to); $message->setTo($to); $message->setBody($body,'text/html'); $result = $mailer->batchSend($message); $toString = implode(",",$to); $this->_log("EMAIL to $toString - $body - $result"); return $result; } What have you guys used for this kind of thing? Is there some server config everyone should do? Thanks! Hey guys.
I am currently hosting my website on my own dedicated server, and i am trying to use the mail() function, but for some reason it doesn't send the email.
This is my php code:
the *** are real addresses.
The from is admin@host.com
<?php $to = "****"; $subject = "Test mail"; $message = "email message."; $from = "***"; $headers = "From:" . $from; mail($to,$subject,$message,$headers); echo "Mail Sent."; ?> Edited by Tzahi_ben_artzi, 02 October 2014 - 02:44 PM. Hi I'm trying to set up my first contact form, but I keep getting this error message:
Parse error: syntax error, unexpected end of file in /home/remem539/public_html/php/testform.php on line 85
here's my code, what am I doing wrong?
<?php
if ($_POST['parse_var'] == "testform"){ |