SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Addict
    Join Date
    Feb 2006
    Posts
    299
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help me with php script for email

    May some one give me php code for email or mail function. I using the following code but it is not working. Or URL where email php code is.

    PHP Code:
    mail($zramail4"YOPUR APPLICATION FROM $zrb $zrd $zrc""$message""From: $zramail2\nBCC: $zramail2"); 
    Please include headers if required.

    Your help will be highly appreciated.
    Thanks.

  2. #2
    SitePoint Evangelist barbara1712's Avatar
    Join Date
    Apr 2007
    Location
    India
    Posts
    509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    $subject="YOPUR APPLICATION FROM ". $zrb . $zrd . $zrc;
    // To send HTML mail, the Content-type header must be set
    $headers = 'MIME-Version: 1.0' . "\r\n";
    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
    // Additional headers
    $headers .= "From: " . $zramail2 . "\r\n";
    $headers .= "BCC: " . $zramail2 . "\r\n";
    if(@mail($zramail4,$subject , "$message", $headers))
    echo "Mail Sent";
    else
    echo "Mail was not send";
    Try this and let me know the result
    Barbara

  3. #3
    SitePoint Addict
    Join Date
    Feb 2006
    Posts
    299
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Barbara;
    It has not worked. Any suggestion??

  4. #4
    SitePoint Guru mmarif4u's Avatar
    Join Date
    Dec 2006
    Location
    /dev/swat
    Posts
    619
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try:

    PHP Code:
      $email =htmlentities($_POST['nmemail']);
      
    $msg =($_POST['message']);
      
    $subject =htmlentities($_POST['subject']);
      
    $headers 'From: XXXXX Team <support@xxxx.com>' "\r\n" .
      
    'X-Mailer: PHP/' phpversion() ."\r\n".
      
    'MIME-Version: 1.0' "\r\n" .
      
    'Content-type: text/html; charset=iso-8859-1' "\r\n";
      
    $message "
    <b>Dear valued subscriber,</b><br><br>

        "
    .$msg."
    <br><br>

    For further information please contact:<br>
    support@xxxx.com.my<br>

    Best regards,<br>
    XXXXXX Team.
    "
    ;

     
    $mail=mail($email,$subject,$message,$headers);
     
    header("Location:message1.php");
     } 

  5. #5
    SitePoint Addict
    Join Date
    Feb 2006
    Posts
    299
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Mmarif4u;
    Iam receiving the the following error message

    Warning: mail() [function.mail]: Failed to connect to mailserver at "mailhoder" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\apache\htdocs\maild\test3.php on line 24

    I have checked my php.ini and it is correct my php.ini mail setting are as follows;

    ;
    ; For Win32 only.
    SMTP = mailhoder
    smtp_port = 25

    ; For Win32 only.
    sendmail_from = zamzam@zatech.com


    where is the problem? How can I solve this one??
    Your help will be highly appreciated.

  6. #6
    SitePoint Guru mmarif4u's Avatar
    Join Date
    Dec 2006
    Location
    /dev/swat
    Posts
    619
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If u r sending from localhost then try this:

    SMTP=Localhost

  7. #7
    play of mind Ernie1's Avatar
    Join Date
    Sep 2005
    Posts
    1,252
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    if you have a local mail server:

    SMTP = localhost

    else

    SMTP = mail.somehost.com // or smtp.somehost.com

    restart the server
    my mobile portal
    ghiris.ro


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
  •