Thursday, October 2, 2014

PHP mail function using Gmail account in Windows XAMPP




1) When we test php mail code in  Windows XAMPP, we do  not have smtp server in localhost. Windows XAMPP has sendmail.exe, but do not have PHPmailer. The following setting will make mail function working in PHP in XAMPP.
2) For example, you install XAMPP in C:\xampp
in C:\xampp\sendmail\sendmail.ini:
[sendmail]
smtp_server=smtp.gmail.com
smtp_port=587
error_logfile=error.log
debug_logfile=debug.log
auth_username=****@gmail.com
auth_password=*******
force_sender=****@gmail.com
in C:\xampp\php\php.ini:
[mail function]
sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"
 
3) Replace  **** to your gmail account name and password.
Restart Apace in XAMPP.
 
4) testmail.php to test if mail function is working
 <?php

    $message = "The mail message was sent with the following mail";
    $headers = "From: youremail@gmail.com";
    mail("youremail@gmail.com", "Testing", $message, $headers);
    echo "Test message is sent to youremail@gmail.com....<BR/>";
   
?>
Change youremail@gmail.com to your email account. You will receive an email. 
Video: PHP mail function using Gmail account in Windows XAMPP
 

5) PHPmailer is another option to send email in PHP. 
reference:
http://jiansenlu.blogspot.ca/2011/08/php-send-email-using-phpmailer-and.html

For Linux, refer to:
https://www.digitalocean.com/community/tutorials/how-to-use-gmail-or-yahoo-with-php-mail-function

2 comments:

  1. Hello
    We are professional traders, earning on forex and binary for investors weekly, will love to tell you all more about our investment platform where you can invest funds as little as $200 and start earning $2500 weekly, alot of people has benefited from this investment offer before and during this convid-19 virus, if you passing through financial difficulties due to this coronavirus and you need help paying bills simply choose a suitable investment plan for yourself and start making profit weekly

    $500 to earn $5,000 in 7 days
    $1000 to earn $10000 in 7 days
    $5000 to earn $50000 in 7 days

    To Start your investment now contact Via whatsapp: (+12166263236)
    email: carlose78910@gmail.com

    ReplyDelete
  2. FRESH SPAMMED UPDATED-2024 FULLZ|PROS|LEADS|INFO

    CC with CVV
    SSN DOB DL ADDRESS
    SIN DOB ADDRESS
    NIN DOB DL SORTCODE ACCOUNT # & ADDRESS UK
    High Credit Scores Pros 700+
    DL|ID Front Back with Selfie
    Business EIN Company Fullz
    Young Age Fullz 2002 to 2014
    Passport Photos
    Multiple Countries ID & DL Front Back with selfie
    Cloning Cards Dumps Track 101 & 202 with PIN
    KYC & Tax Return Filling Fullz
    SBA|PUA|UI|UBEREATS|DOORDASH Account Opening Fullz

    TOOLS & TUTORIALS ARE ALSO AVAILABLE
    SMTP|RDP|C-PANELS
    SHELLS|WEB-MAILERS
    BULK SMS SENDER|EMAIL SENDER
    I.P's|PROXIES
    CARDING METHODS & TUTORIALS
    LOAN METHODS
    SPAMMING ALL TOOLS WITH TUTORIALS & GUIDES

    Everything will be Fresh, Genuine & Legit
    100% Verified info will be provided
    No Refund Policy|Only Replacement
    Payment option USDT|BTC or any crypto

    Below are our contact details:

    ICQ = 752822040|@killhacks
    Telegram = @killhacks|@leadsupplier
    Email = hacksp007 @ DNMX . org
    Skype = @peeterhacks

    ReplyDelete