FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Mail() function
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Mail() function [message #180607 is a reply to message #180605] Wed, 06 March 2013 15:37 Go to previous messageGo to previous message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma:
Senior Member
On 06/03/13 14:46, Rita Ferreira wrote:
> Hi,
> I'm new at PHP and I'm facing problems with the mail() function.
> I'm trying to send an email from a form and to do it I'm using mail() function but gmail assume it like spam.
>
> I have read lots of similar problems in internet but I couldn't find a solution.
>
>
> <?php
>
> if (isset($_REQUEST['email']))
> {
> $nome = $_REQUEST['nome'] ;
> $telefone = $_REQUEST['telefone'] ;
> $email = $_REQUEST['email'] ;
> $message = $_REQUEST['mensagem'] ;
> $header .= "Reply-To:".$nome." <".$email.">\r\n";
> $header .= "Return-Path: ".$nome." <".$email.">\r\n";
> $header .= "From: ".$nome." <".$email.">\r\n";
> $header .= "Organization: MyOrganization\r\n";
> $header .= "Content-Type: text/plain\r\n";
>
> mail("XXXXX(at)gmail(dot)com", "My message", $message, $header);
>
> header ('Location:index_teste.php?area=contactenos');
> }
>
>
> Can you please help me trying to find what I do have wrong here?
> Any help will be welcome.
> Thanks.
>

the line the works for me is this

mail($email, $subject, $message, $headers, "-f ".$return_path );

Note the -f argument to set a valid sender address, otherwise mail
relays can and will reject the message.

In my case $return_path contains 'webmaster(at)mysite(dot)com' etc etc.

Also depending on the server you are posting from, the mail relay
subsystem may not be set up correctly.

--
Ineptocracy

(in-ep-toc’-ra-cy) – a system of government where the least capable to
lead are elected by the least capable of producing, and where the
members of society least likely to sustain themselves or succeed, are
rewarded with goods and services paid for by the confiscated wealth of a
diminishing number of producers.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Dynamically change video URLs
Next Topic: Other source for help?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Nov 22 09:43:19 GMT 2024

Total time taken to generate the page: 0.04273 seconds