how to send email with php?

Discussion in 'PHP' started by figo2476, Jul 31, 2007.

  1. #1
    Hi:

    I set up WAMP(which is php+apache+mysql....etc) & ArGoSoft mail server in my
    desktop...When a test a form, I got an error: Warning: mail() [function.mail]: SMTP server response: 551 User not local. We don't relay...

    Inside the mail function, I set mail("bla@gmail.com", .., .., ..). Does it mean gmail doesn't accept the mail sent from my web server?

    Then I tried:
    
    ini_set("SMTP","mail.google.com");
    ini_set("smtp_port","587");
    ini_set("username","bla");
    ini_set("password","bla");
    mail("bla@gmail.com"......); 
    
    
    set SMTP = mail.google.com in php.ini, then it says it cannot connect to the mail server.
    
    PHP:
     
    figo2476, Jul 31, 2007 IP
  2. figo2476

    figo2476 Peon

    Messages:
    32
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I think what I did with the gmail server is not correct. Since I have set up my own mail server. I should not use the gmail one... Then I back to the 551 not local user problem...
     
    figo2476, Jul 31, 2007 IP
  3. mark84

    mark84 Peon

    Messages:
    56
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Isnt google's smtp server => smtp.gmail.com ?
     
    mark84, Jul 31, 2007 IP
  4. figo2476

    figo2476 Peon

    Messages:
    32
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    * right....
    * Then I got SMTP server response: 530 5.7.0 Must issue a STARTTLS command .....
     
    figo2476, Aug 1, 2007 IP
  5. figo2476

    figo2476 Peon

    Messages:
    32
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    But in this case, I use smtp of gmail not my installed stmp server......?
     
    figo2476, Aug 1, 2007 IP
  6. figo2476

    figo2476 Peon

    Messages:
    32
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I am a bit confused here:

    * I can use free smtp server + WAMP to run for form submission or stmp.gmail.com (a remote) + WAMP for form submission?

    * How many ports do I need to open? I open port 587 for the local smtp & stmp.gmail.com. I open a port for WAMP, it uses port 81. When I mean open a port, I forward them in router & open it in windows firewall. Do I need to open it in the free zoneAlarm...since I am not sure how to do so or only premium products can do so?

    * Eventually, I try free smtp server + WAMP & ports 587, 81... It times out, when I assess it via anonymouse.org
     
    figo2476, Aug 1, 2007 IP
  7. pfek

    pfek Member

    Messages:
    98
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    45
    #7
    After you choose your SMTP server, I suggest you use phpMailer. It's really a good class for php, it will handle for you almost everything about Mails.
     
    pfek, Aug 1, 2007 IP