|
|
|
|
![]() ![]() |
Apr 12 2006, 03:52 PM
Post
#1
|
|
|
Super Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 258 Joined: 13-November 05 Member No.: 14,234 |
im just trying to send mail by using a very simple php function mail() but it is not working.the format is
CODE $to = "email@example.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>"); } I think there is something wrong with php.ini setting..maybe something to do with SMTP settings.. i want to send email FROM either hotmail , gmail , or yahoo or any other web based email because i dont know my ISP smtp setting..so can anyone please help me , where to make change and what to make change ? |
|
|
|
Apr 12 2006, 04:23 PM
Post
#2
|
|
|
Look around, what do you see? Incorrect. ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 1,120 Joined: 12-April 06 From: Essex, UK Member No.: 21,719 myCENT:85.74 |
im just trying to send mail by using a very simple php function mail() but it is not working.the format is $to = "email@example.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>"); } I think there is something wrong with php.ini setting..maybe something to do with SMTP settings.. i want to send email FROM either hotmail , gmail , or yahoo or any other web based email because i dont know my ISP smtp setting..so can anyone please help me , where to make change and what to make change ? I've used the mail function quite alot on external hosts and its worked fine. When i tried to run this script on my localhost i got an error saying i needed to configure my php.ini settings for the FROM address but im not confident with playing with .ini settings and such so i left that be. If you want to send an email and have the FROM address be anything specific you an use the headers variable in the mail() function. eg: QUOTE $headers = FROMaddress@whatever.com; mail($to, $subject, $body, $headers); now when the mail is received the from address will be FROMaddress@whatever.com. The only problem is if sending to a hotmail user, or possibly some other email accounts, but particularly in hotmail the email provider will notcie the diferene in domains, eg sending the email from subdomain.trap17.com but having the FROM address as me@host.com hotmail will notice the differences and alert the user that the sender cannot be verified. If however your website was me.myhost and the FROM address was notme@myhost there would be no problem. I hope that helped with changing the FROM address. Sorry I cant help much about the problem with it not working though. NOTE: it seems by editing this line QUOTE ; For Win32 only. ;sendmail_from = me@example.com in your .ini file you can permanently set the FROM address without using the $headers method. EDIT: Is there an error display when you try to use the mail function that is outputted to the browser? if there is could you post it and maybe it will help someone to see whats going on. This post has been edited by shadowx: Apr 12 2006, 04:24 PM |
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 23rd November 2008 - 06:16 PM |