SitePoint Sponsor

User Tag List

Results 1 to 10 of 10
  1. #1
    SitePoint Member edpudol's Avatar
    Join Date
    Oct 2004
    Location
    philippines
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Problem with mail function

    Hello every one.. I have a problem with my code regarding the mail function. I don't get any error but I don't get any email... Here is the code..

    $msg="My message";
    mail("$email","message subject",$msg,"From: phpFormGenerator");
    I try this one too

    $msg = "Message Here" ;

    $headers = "MIME-Version: 1.0\n";
    $headers .= "Content-type: text/plain; charset=iso-8859-1\n";
    $headers .= "From: \"$fullname\" <emaill@email.com>\n";
    $headers .= "Reply-To: \"$fullname\" <email@email.com\n";
    $headers .= "X-Mailer: PHP's mail() Function\n";

    mail("$email","subject",$msg,"$headers");
    but still won't work.. but when i try to my other server the script works... both server are php script supported.

    Any Idea ?

    Thanks
    Visit us at lexorsoft.net , if you need SEO related services

  2. #2
    SitePoint Enthusiast
    Join Date
    Dec 2004
    Location
    Johannesburg
    Posts
    52
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello - have a look at this thread http://www.sitepoint.com/forums/showthread.php?t=218122

    Hope it helps

  3. #3
    SitePoint Member edpudol's Avatar
    Join Date
    Oct 2004
    Location
    philippines
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks buddy but I think... even on that post the problem does not solved. The suggested link which is http://phpmailer.sourceforge.net/ . This is find may be if I am in control with my server.

    So any other suggestion please.
    Visit us at lexorsoft.net , if you need SEO related services

  4. #4
    SitePoint Enthusiast
    Join Date
    Dec 2004
    Location
    Johannesburg
    Posts
    52
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Have you downloaded Phpmailer and tried it on your server?

    but still won't work.. but when i try to my other server the script works...
    What is the difference between your two servers?

  5. #5
    SitePoint Member edpudol's Avatar
    Join Date
    Oct 2004
    Location
    philippines
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Do I need the permission of the hosting admin to install the script (Phpmailer)? Thanks pal for responding
    Visit us at lexorsoft.net , if you need SEO related services

  6. #6
    SitePoint Enthusiast
    Join Date
    Dec 2004
    Location
    Johannesburg
    Posts
    52
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No you don't. PHPMailer contains two main php scripts: class.mailer.php and class.smtp.php. Copy these two files, along with the language folder that comes with PHPMailer to your webdirectory on the server.

    Then when you want to send an email you will use code something like:

    include("class.phpmailer.php");

    PHP Code:
    $mail = new PHPMailer();

    $mail->From  "me@me.com";
    $mail->FromName "Me";
    $mail->Host "smtp.site.com";
    $mail->Mailer "smtp";

    $mail->Subject "Subject";
    $mail->Body "test email"#HTML body
    $mail->AltBody "test email"# Text body
    $mail->AddAddress("abc@whatever.com""John");
    $mail->Send()
    $mail->ClearAddresses(); 

  7. #7
    SitePoint Member edpudol's Avatar
    Join Date
    Oct 2004
    Location
    philippines
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey.. thanks buddy I will try today I let you know.. if it works..
    Visit us at lexorsoft.net , if you need SEO related services

  8. #8
    SitePoint Member edpudol's Avatar
    Join Date
    Oct 2004
    Location
    philippines
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks buddy it works..
    Visit us at lexorsoft.net , if you need SEO related services

  9. #9
    SitePoint Member edpudol's Avatar
    Join Date
    Oct 2004
    Location
    philippines
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi 9802008,

    How could i put a line space on my message \r and <br> won't work...

    Thanks
    Visit us at lexorsoft.net , if you need SEO related services

  10. #10
    SitePoint Enthusiast
    Join Date
    Dec 2004
    Location
    Johannesburg
    Posts
    52
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thats good news!

    Use \n for the text version of your message (for users who have set their email software to view emails in text format).

    and use <br> for the html version of your message (for users who have set their email software to view emails in html format).


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •