The Midnighter Posted February 17, 2009 Share Posted February 17, 2009 Good day. My code works when sending an email, however it shows up in my inbox as sent from "Nobody" and the email is some bogus email from our mail server, How can I set where the mail comes from, or at least let it think that's where it comes from? Link to comment https://forums.phpfreaks.com/topic/145565-solved-sending-email/ Share on other sites More sharing options...
gevans Posted February 17, 2009 Share Posted February 17, 2009 Show us what code you're using at the moment, and an example of the bogus email Link to comment https://forums.phpfreaks.com/topic/145565-solved-sending-email/#findComment-764198 Share on other sites More sharing options...
allworknoplay Posted February 17, 2009 Share Posted February 17, 2009 Here you go. http://us2.php.net/mail Link to comment https://forums.phpfreaks.com/topic/145565-solved-sending-email/#findComment-764201 Share on other sites More sharing options...
The Midnighter Posted February 17, 2009 Author Share Posted February 17, 2009 $to = $agent; $from = "[email protected]"; $subject = "A file has been uploaded"; $headers = 'Return-Path: ' . $from . "\n"; $body = "Hello, " . $name . " has uploaded a file, " . $target_path ." Email: " . $email . " Company: " . $company . " Phone: " . $phone ." Comments: " . $comment; if (mail($to, $subject, $body, $headers)) { echo("<p>Email Message successfully sent!</p>"); } else { echo("<p>But message delivery failed...</p>"); } That's the jist of my code right now. Allworknoplay, that didn't help at all. Thanks though. Link to comment https://forums.phpfreaks.com/topic/145565-solved-sending-email/#findComment-764231 Share on other sites More sharing options...
The Midnighter Posted February 17, 2009 Author Share Posted February 17, 2009 I found the answer. The answer was to do this, to the mail function... if (mail($to, $subject, $body,"", "-r [email protected]")) It uses the "Additional_headers" column to enter the return mail. Link to comment https://forums.phpfreaks.com/topic/145565-solved-sending-email/#findComment-764238 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.