SitePoint Sponsor

User Tag List

Results 1 to 10 of 10
  1. #1
    SitePoint Zealot
    Join Date
    Oct 2006
    Location
    Syracuse, NY
    Posts
    118
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    setup ext. SMTP server with php

    I need to setup an external SMTP server to send mail with php. I'm on a windows 2000 machine running iis 5. The external server requires a username and password as well. Any suggestions?

  2. #2
    play of mind Ernie1's Avatar
    Join Date
    Sep 2005
    Posts
    1,252
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I recommend swiftmailer
    my mobile portal
    ghiris.ro

  3. #3
    SitePoint Zealot
    Join Date
    Oct 2006
    Location
    Syracuse, NY
    Posts
    118
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have swift installed but it doesn't seem to be working. Does anyone know swift well enough to see what Im doing wrong below?
    PHP Code:
                    require_once "../Swift/lib/Swift.php";
            require_once 
    "../Swift/lib/Swift/Connection/SMTP.php";
            require_once 
    "../Swift/lib/Swift/Authenticator/LOGIN.php";
            
            
            
    $conn =& new Swift_Connection_SMTP("mail.midstatemutual.com");
            
    $conn->attachAuthenticator(new Swift_Authenticator_LOGIN());
     
            
    $swift =& new Swift($conn);
            
    $smtp->setUsername("user_hidden");
            
    $smtp->setpassword("pass_hidden");
             
            
    $swift =& new Swift($smtp);
            
            if (
    $swift->send($message"gregj@midstatemutual.com""admin@midstatemutual.com")) echo "Sent";
            else echo 
    "Failed"

  4. #4
    play of mind Ernie1's Avatar
    Join Date
    Sep 2005
    Posts
    1,252
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try this and tell me if it works:
    PHP Code:
    require_once "lib/Swift.php";
    require_once 
    "lib/Swift/Connection/SMTP.php";
    require_once 
    "lib/Swift/Authenticator/LOGIN.php";
     
    $conn =& new Swift_Connection_SMTP("smtp.domain.tld");
    $conn->attachAuthenticator(new Swift_Authenticator_LOGIN());

    $conn->setUsername("ernie");
    $conn->setPassword("password");
     
    $swift =& new Swift($conn);

    //Create the message
    $message =& new Swift_Message("My subject""My body");

    if (
    $swift->send($message"ernie@domain.tld""admin@domain.tld")) echo "Sent"
            else echo 
    "Failed"
    my mobile portal
    ghiris.ro

  5. #5
    SitePoint Zealot
    Join Date
    Oct 2006
    Location
    Syracuse, NY
    Posts
    118
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I tried that code... When i submit the form and it goes to execute that code, it just brings up a blank page. Does this mean its not finding the "lib" directory? I have it pointed directly to it... not sure why it doesn't even give me the "Sent" or "Failed" messages?

  6. #6
    play of mind Ernie1's Avatar
    Join Date
    Sep 2005
    Posts
    1,252
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    download the latest version of swiftmailer and save my code in swift folder.
    change the smtp.domain.tld, user, password and the sender-receiver address.
    run the script.
    my mobile portal
    ghiris.ro

  7. #7
    SitePoint Zealot
    Join Date
    Oct 2006
    Location
    Syracuse, NY
    Posts
    118
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I got it working finally! I'm an idiot, I had the user name gregj instead of gregj@address.com. Wow, im sorry about that guys, thanks for all for your help though, I appreciate it!

  8. #8
    play of mind Ernie1's Avatar
    Join Date
    Sep 2005
    Posts
    1,252
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    did you use my code?
    my mobile portal
    ghiris.ro

  9. #9
    SitePoint Zealot
    Join Date
    Oct 2006
    Location
    Syracuse, NY
    Posts
    118
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yessir, thank you

  10. #10
    play of mind Ernie1's Avatar
    Join Date
    Sep 2005
    Posts
    1,252
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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
  •