473,322 Members | 1,538 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

want my email sent using SMTP

hi,
my problem is that i have created contact form in this i filled all my fields sends it to the others email address, the mail is recieved by the person but the senders name is not displaying in the reciptent's mail so here is code i have used it plz have a look an give the possible solution.
code is:
[php]
<?php
$name = trim($_POST['name']);
$email = trim($_POST['email']);
$friendname = trim($_POST['friendname']);
$friendemail = trim($_POST['friendemail']);
$message = trim($_POST['msg']);

$mail_to= $friendemail;
$mail_from= $email;
$mail_sub= "Paul Taylor Dance Company";
$mail_mesg = $message;

// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "/r/n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "/r/n";

// Additional headers
//$headers .= 'To: '.$friendname.' '.$friendemail . "\r\n";
$headers .= 'From: '.$name.' '.$email . "/r/n";
$headers .= 'Reply-To: '.$name.' '.$email . "/r/n";

mail($mail_to,$mail_sub,$mail_mesg,$headers);
?>
[/php]
Oct 10 '07 #1
3 1653
ronverdonk
4,258 Expert 4TB
Welcome to TSDN!

Next time, read the Posting Guidelines before you show code in a post. Especially the part about enclosing code with in code tags.

It could be possible that the newline/carriage return definitions cause this problem. You specify them with backward slashes, as in "\r\n".

Ronald
Oct 10 '07 #2
hi ,
thaks for ur rply, i tried that but that doesnt work but again i changed my code using SMTP with phpmailer which is as:


Expand|Select|Wrap|Line Numbers
  1.  <?php
  2.     $name = trim($_POST['name']);
  3.     $email = trim($_POST['email']);
  4.     $friendname = trim($_POST['friendname']);
  5.     $friendemail = trim($_POST['friendemail']);
  6.     $message = trim($_POST['msg']);
  7.  if(!class_exists('PHPMailer'))
  8.  {
  9.  require("ptdc/phpmailer-1.73/phpmailer" . '/class.phpmailer.php');
  10.  }
  11.  
  12.     $mail = new PHPMailer();
  13.  
  14. $mail->From     = $email;
  15. $mail->FromName = $name;
  16. $mail->AddAddress($friendemail, $friendname);
  17. // Fill in Username and Password for servers requiring authentication
  18. //$mail->Username = $smtp_username;
  19. //$mail->Password = $smtp_password;
  20.  
  21. // SMTP server name
  22. $mail->Host     = "<removed>";
  23. $mail->Mailer   = "smtp";
  24.  
  25. $mail->Subject = "Paul Taylor Dance Company"; ;
  26. $mail->Body    =   $message ;
  27.  
  28. if(!$mail->Send()) $results = 'Error message';
  29. else $results = 'Success message';
  30. You can read the documentation, advanced
  31.  
  32.  
  33. ?>
Oct 10 '07 #3
ak1dnar
1,584 Expert 1GB
try like this.

[PHP]$headers .= 'From: '.$name.' <'.$email.'>' . "\r\n";[/PHP]

Second reminder: Do not miss the code tags when posting source codes.
Oct 10 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: John Silver | last post by:
I have a perl script running on machine A, a web server. A visitor completes certain pieces of data and these are compiled into two emails, one addressed to the visitor and copied to the site...
0
by: David Burson | last post by:
Hi, I have a VB.NET windows app that needs to automatically send a simple text email when my users run a new version of the app for the first time. I thought this would be simple, but after...
8
by: JayB | last post by:
We sent out an email today to a list of subscribers from our database using ASP and CDO. For some reason, many people received it twice, including myself. I checked the database and there were do...
24
by: Arno R | last post by:
Hi all, I have a client with several shoe-shops. Customers can leave their email-address if they want to be notified when there is a sale. Input is validated with instr() I am checking for @...
1
by: bivin | last post by:
hai i am requesting your technical support. please help me. i have been working with this for five days. the problem is relating with the smtp. i am trying to send an email from the asp.net...
8
by: Mike Owen | last post by:
Hi, I am using the following code to send email on a Windows 2003 Web Server: Imports System.Net.Mail ........ Dim msgmail As New MailMessage msgmail.To.Add(New...
2
by: sunnyko | last post by:
Dear all I am using asp.net in a Small Business Server to send email out ! The programe work fine in XP but show the following error in Small Business Server. I don't know why.... Sunny ...
2
by: shapper | last post by:
Hello, I have a contact form in my web site which is working just fine on my computer! When I uploaded my web site to my hosting server I get an error when I SUBMIT my form, i.e., when I...
3
by: YMPN | last post by:
Hi Everyone, I'm deen from Riyadh. Please do help me with some problem i have. I have this formview control setup to recieved inputs from user (textbox, dropdownlist, others). After...
1
by: creative1 | last post by:
When I test the application I get follwowing error: could not connect to smtp host: connection timeout error can someone please check if I have rigth settings? Where I am wrong here Is IP and...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.