473,385 Members | 1,325 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,385 software developers and data experts.

Sending mails with Php

Hi .this is punit .I am back with one question on php.
I want make mail option in my project .please tell me how i code for sending mail option in php.As i am new in php so please suggest me how i proceed.
Thanks & Regards.
Punit Shrivastava
Aug 8 '07 #1
4 1173
ak1dnar
1,584 Expert 1GB
Hi .this is punit .I am back with one question on php.
I want make mail option in my project .please tell me how i code for sending mail option in php.As i am new in php so please suggest me how i proceed.
Thanks & Regards.
Punit Shrivastava
I think there are lots of threads here, about php mail function.
Search Results

Additionally you may take a look at on php mail funtion
Aug 8 '07 #2
ak1dnar
1,584 Expert 1GB
Hope the current thread title makes good traffic on the thread rather than the Original:

Disscusion for sending mail
Aug 8 '07 #3
Hi Ajaxrand,
Thanks for suggesting.I code for contact form like this:
for 1st form :
Expand|Select|Wrap|Line Numbers
  1. <table width="400" border="0" align="center" cellpadding="3" cellspacing="1">
  2. <tr>
  3. <td><strong>Contact Form </strong></td>
  4. </tr>
  5. </table>
  6.  
  7. <table width="400" border="0" align="center" cellpadding="0" cellspacing="1">
  8. <tr>
  9. <td><form name="form1" method="post" action="mailform.php">
  10. <table width="100%" border="0" cellspacing="1" cellpadding="3">
  11. <tr>
  12. <td width="16%">Subject</td>
  13. <td width="2%">:</td>
  14. <td width="82%"><input name="subject" type="text" id="subject" size="50"></td>
  15. </tr>
  16. <tr>
  17. <td>Detail</td>
  18. <td>:</td>
  19. <td><textarea name="detail" cols="50" rows="4" id="detail"></textarea></td>
  20. </tr>
  21. <tr>
  22. <td>Name</td>
  23. <td>:</td>
  24. <td><input name="name" type="text" id="name" size="50"></td>
  25. </tr>
  26. <tr>
  27. <td>Email</td>
  28. <td>:</td>
  29. <td><input name="customer_mail" type="text" id="customer_mail" size="50"></td>
  30. </tr>
  31. <tr>
  32. <td>&nbsp;</td>
  33. <td>&nbsp;</td>
  34. <td><input type="submit" name="Submit" value="Submit"> <input type="reset" name="Submit2" value="Reset"></td>
  35. </tr>
  36. </table>
  37. </form>
  38. </td>
  39. </tr>
  40. </table>
  41.  
And for 2nd form i code like this :
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. // Contact subject
  3. $subject ="$subject"; 
  4. // Details
  5. $message="$detail"; 
  6.  
  7. // Mail of sender
  8. $mail_from="$customer_mail"; 
  9. // From 
  10. $header="from: $name <$mail_from>"; 
  11.  
  12. // Enter your email address
  13. $to ='YOU@YOURDOMAIN.COM'; 
  14.  
  15. $send_contact=mail($to,$subject,$message,$header);
  16.  
  17. // Check, if message sent to your email 
  18. // display message "We've recived your information"
  19. if($send_contact){
  20. echo "We've recived your contact information";
  21. }
  22. else {
  23. echo "ERROR";
  24. }
  25. ?>
  26.  
But its shows error As it disply :-
Warning: mail() [function.mail]: SMTP server response: 550 5.7.1 Unable to relay for YOU@YOURDOMAIN.COM in C:\Uniform3_1_1s\www\abc\mailform.php on line 23
ERROR .
Please suggest me about code .As i am new in php so kindly give me suggestion regarding to code.

I think there are lots of threads here, about php mail function.
Search Results

Additionally you may take a look at on php mail funtion
Please use code tags [code=php] .........[ /code] - ajaxrand
Aug 8 '07 #4
ak1dnar
1,584 Expert 1GB
Nice work ! There is No problem with your html form. But there are few issues with php script.

Didn't you try to get the POSTed values to Variables
Expand|Select|Wrap|Line Numbers
  1. $your_variable_name = $_POST['html_form_element'];
I didn't see them on the script.

Then The Error says something Like this, Your SMTP server doesn't allow you to send the mails.

If you are trying this on a Local server Set up your SMTP server to send mails.
Aug 8 '07 #5

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

Similar topics

10
by: Stuart Mueller | last post by:
I have an exchange server, that I sometimes use to perform mail shots to clients on our database, these can be upwards of 1000 at a time. As we don't want different clients to see who we are...
3
by: martin smith | last post by:
Here's the scenario. I'm currently using cdosys/asp to send mail to our SMTP server. We use a product called MailFilter to check for SPAM. It doesn't work very well. If MailFilter isn't working...
1
by: Jayakumar | last post by:
HI, I am using System.web.mail class in my application to send mails. I am using SMTP server for the same. I can send mail to the intranet addresses, But when i send mails to Hotmail or other...
7
by: Lau | last post by:
I need to send 1000 emails from an asp.net website. Normally I would use System.Web.Mail.MailMessage() to send thru an SMTP server. But the large amount of emails results in a timeout. My server...
5
by: cashdeskmac | last post by:
I am writing a web application will will be hosted on a few peoples laptops as a local application. It will send e-mails once the user connects to the internet. How can I set up the "Mail.From"...
1
by: Dirk Goossens | last post by:
Hello! I'm sending E-mails to mailadresses in a table, using the code below. How can I send more than one attachment? Access can find the file to be send in this field: MY_EMAILATTACHMENT_FIELD...
8
by: Michel Posseth [MCP] | last post by:
Hi does someone has experience with this ?? i have made a lot of apps in the past that were capable of sending e-mails the server i then talked to was a Linux SMTP server and it worked great ...
1
by: gemma.gill | last post by:
Hi There, I have a button on a form within access that sends a verification e- mail. My problem is that these e-mails are sending from individual user accounts rather than a genieric mailbox. ...
3
by: dskinibbyb | last post by:
Hi Everybody, I am sending mail using the new class in .Net 2.0. Here while sending internal mails it is giving me problem. Carriage return, Line feed and Spaces are lost while sending mails....
2
by: srinivaspnv21 | last post by:
hi every one, plz help me out, i have to send mails from my asp.net page.... I have tried a code where mails are going only to gmail users the code is ... namespace: using System.Web.Mail;...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.