473,888 Members | 2,199 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

want my email sent using SMTP

3 New Member
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 1675
ronverdonk
4,258 Recognized Expert Specialist
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
speedmaster
3 New Member
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 Recognized Expert Top Contributor
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
4533
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 owner, the other addressed to the webmaster and including cookie and timing data for debugging. The email is sent by machine B which is the email server for the domain. Here are some config values for the perl script, names have been changed to...
0
3717
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 days of reading posts and testing, I see it is not - unless I'm missing something? I'm not an email guru. All of my users will be running at least Windows 2000, most on XP sp2. Some of my users will have Outlook, many will be using Outlook...
8
1915
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 duplicate records and I know for sure that I have no other email address forwarding email. I checked my code and all seems ok. Perhaps someone can take a look at it and see if I screwed up somewhere? It was sent to over 9,000 email addresses. When...
24
7144
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 @ and . (required) and also checking for spaces (not allowed). But: A LOT (5-10%) of the addresses still are wrong; (provider doesn't exist) or email-address not valid (anymore). When sending bulk-mail its a nasty problem to get the false addresses...
1
8048
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 page. earlier it was showing send using not find error.
8
2507
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 MailAddress(objMember.EmailAddress)) msgmail.From = New
2
2213
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 Server Error in '/email' Application.
2
1528
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 click submit to send the email: Security Exception Description: The application attempted to perform an operation not
3
4518
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 inserting, I want to send the data via email, the problem is how do I do that?
1
1800
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 mail host setting ok or not? Contactus.jsp <!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN//"> <html>
0
9957
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9799
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11173
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10772
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10878
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10434
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9593
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6011
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3245
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.