1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

PHP mail function & GoDaddy Hosting ?!?

Discussion in 'PHP' started by anton-io!, Feb 18, 2008.

  1. #1
    Anyone come across a solution for sending emails from GoDaddy hosting using php mail() function?

    My scripts will work with other web host providers, having issues with GoDaddy where sent email has 'FROM: ' in the from headers?

    :confused:

    
    // Sample --------------------------
    $headers  = "MIME-Version: 1.0\r\n"; 
    $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; 
    $headers .= "To: $EmailTO \r\n"; 
    $headers .= "From: $EmailFrom <$EmailFrom>\r\n"; 
    $headers .= "Cc: \r\n"; 
    $headers .= "Bcc: \r\n"; 
    mail($to, $subject, $message, $headers);
    
    
    Code (markup):
     
    anton-io!, Feb 18, 2008 IP
  2. Colbyt

    Colbyt Notable Member

    Messages:
    3,224
    Likes Received:
    185
    Best Answers:
    0
    Trophy Points:
    210
    #2
    I am using php mail on GD with no apparent problems. Old script with globals on.

    I have sent you an message source code sent from there in the hopes it might help you.
     
    Colbyt, Feb 18, 2008 IP
    anton-io! likes this.
  3. The Critic

    The Critic Peon

    Messages:
    392
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #3
    It works fine for me on GoDaddy as well.
     
    The Critic, Feb 19, 2008 IP
  4. anton-io!

    anton-io! Active Member

    Messages:
    540
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    58
    #4
    Colbyt - thanks for your help and PM

    The php.net site, under the mail() functions, also has a nice simple Godaddy working example

    Resolved - thanks again! :D
     
    anton-io!, Feb 19, 2008 IP
  5. rightsidenov

    rightsidenov Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I too am having some trouble getting the mail function to work right on a GoDaddy windows server. I saw the example on php.net, but I'm not quite sure how to implement it correctly. Where do I get the mail.php file from. And since the code has PEAR in it, do I need to save the file that the function is in as a different format then php? I've never worked with PEAR before.

    I've tried just copying the function as it is, and of course inserting the user/pass for the account, but it doesn't seem to be working. I think it is because it can not find the mail.php file. Any help with this would be great, thanks!
     
    rightsidenov, Mar 28, 2008 IP
  6. anton-io!

    anton-io! Active Member

    Messages:
    540
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    58
    #6
    rightsidenov, there's a post on php.net that I used that worked

    
    require_once "Mail.php";
    
    function emailHtml($from, $subject, $message, $to) {
    $host = "localhost";
    $username = "";
    $password = "";
    
    $headers = array ('MIME-Version' => "1.0", 'Content-type' => "text/html; charset=iso-8859-1;", 'From' => $from, 'To' => $to, 'Subject' => $subject);
    
    $smtp = Mail::factory('smtp', array ('host' => $host, 'auth' => false));
    
    $mail = $smtp->send($to, $headers, $message);
    if (PEAR::isError($mail))
    return 0;
    else
    return 1;
    }
    
    
    Code (markup):
    Need to use their Mail.php script

    Hope this helps
     
    anton-io!, Apr 2, 2008 IP
  7. NewTier

    NewTier Notable Member

    Messages:
    2,201
    Likes Received:
    196
    Best Answers:
    0
    Trophy Points:
    250
    #7
    Godaddy does not allow the mail function because spammers have been using it and abusing it to mass mail people.

    But test it one more time with this:


    Sitepoint Post here: http://www.25x.us/?urqgNGYeRU
     
    NewTier, Apr 2, 2008 IP
  8. e2developer

    e2developer Peon

    Messages:
    31
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Hi all,

    I am having the same mail problem with godaddy server, site is hosted on godaddy's windows server (shared hosting).
    I have gone through with all the solutions given above and try to use these but it does'nt seems to work.
    Please suggest me a way.
     
    e2developer, Mar 9, 2009 IP
  9. je61

    je61 Peon

    Messages:
    149
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Me too, anyone else got another fix?
     
    je61, May 29, 2009 IP
  10. Hmmmm

    Hmmmm Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    Contact GoDaddy admin and ask that they transfer you to a server that supports PHP5. You may be on a server that only supports PHP4.
     
    Hmmmm, May 30, 2009 IP
  11. NeoCambell

    NeoCambell Peon

    Messages:
    456
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #11
    NeoCambell, Dec 21, 2009 IP
  12. bantayso

    bantayso Active Member

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    56
    #12
    I try to send mail by mail() but error
     
    bantayso, Nov 11, 2011 IP
  13. dpgamer

    dpgamer Greenhorn

    Messages:
    29
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    13
    #13
    If the php mail function does not work you can try to send mail from PHP using PHP Mailer.
     
    dpgamer, Nov 18, 2011 IP
  14. redesignunit@gmail.com

    redesignunit@gmail.com Banned

    Messages:
    230
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    108
    #14
    try this hope work for you

    1) Install the WP-Mail-SMTP plug-in. Activate it.
    2) Enter your From Email and Name
    3) Setup the Mailer settings as follows:

    Mailer:
    * Use the PHP mail() function to send emails.

    SMTP Options
    SMTP Host: relay-hosting.secureserver.net
    SMTP Port: 25
    Encryption:
    * No encryption.
    Authentication:
    * Yes: Use SMTP authentication.

    4) Enter your valid email account credentials.
    Username:
    Password:

    5) Update options.
    6) Send test mail. You should get this result:
    Test Message Sent
    The result was:
    bool(true)
     
    redesignunit@gmail.com, Oct 12, 2015 IP
  15. Fernando V

    Fernando V Member

    Messages:
    13
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    43
    #15
    If you are using shared hosting it is very likely the server IP is black listed. It is better you use a VPS where your IP is only for you, or use SMTP with external email provider.
     
    Fernando V, Oct 13, 2015 IP