Advertisement
Guest User

Add SMTP on windows

a guest
Feb 16th, 2018
707
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.46 KB | None | 0 0
  1. As mentioned earlier, for Windows users there is a fake sendmail option. A bit more detailed description how to do this is:
  2.  
  3. If you have a test server in use running Windows and some kind of WAMP combo (XXAMP, WAMP Server, etc) then you'll notice that the PHP sendmail command (mail()) does not work. Windows simply does not provide the sendmail statement ...
  4.  
  5. There is a simple trick to get this to work though;
  6.  
  7. 1) Download (or use the attached file) sendmail.zip from http://glob.com.au/sendmail/
  8.  
  9. 2) Unzip this in a folder on your c: drive (preferably use a simple path, for example c:\wamp\sendmail -- long filenames could cause problems)
  10.  
  11. 3) Edit your PHP.INI file (note: WAMP users should access their php.ini file from the WAMP menu). Go to the [mail function] section and modify it as such:
  12.  
  13. [mail function]
  14. ; For Win32 only.
  15. ;SMTP =
  16.  
  17. ; For Win32 only.
  18. ;sendmail_from =
  19.  
  20. ; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
  21. sendmail_path = "C:\wamp\sendmail\sendmail.exe -t"
  22.  
  23. ; Force the addition of the specified parameters to be passed as extra parameters
  24. ; to the sendmail binary. These parameters will always replace the value of
  25. ; the 5th parameter to mail(), even in safe mode.
  26. ;mail.force_extra_paramaters =
  27.  
  28. .. and save the changes.
  29.  
  30. 4) Open the sendmail.ini and modify the settings to:
  31.  
  32. [sendmail]
  33.  
  34. ; you must change mail.mydomain.com to your smtp server,
  35. ; or to IIS's "pickup" directory.  (generally C:\Inetpub\mailroot\Pickup)
  36. ; emails delivered via IIS's pickup directory cause sendmail to
  37. ; run quicker, but you won't get error messages back to the calling
  38. ; application.
  39.  
  40. smtp_server=mail.yourdomain.com
  41.  
  42. ; smtp port (normally 25)
  43.  
  44. smtp_port=25
  45.  
  46. ; the default domain for this server will be read from the registry
  47. ; this will be appended to email addresses when one isn't provided
  48. ; if you want to override the value in the registry, uncomment and modify
  49.  
  50. default_domain=yourdomain.com
  51.  
  52. ; log smtp errors to error.log (defaults to same directory as sendmail.exe)
  53. ; uncomment to enable logging
  54. ; error_logfile=sendmail_error.log
  55.  
  56. ; create debug log as debug.log (defaults to same directory as sendmail.exe)
  57. ; uncomment to enable debugging
  58. ; debug_logfile=sendmail_debug.log
  59.  
  60. ; if your smtp server requires authentication, modify the following two lines
  61.  
  62. ;auth_username=
  63. ;auth_password=
  64.  
  65. ; if your smtp server uses pop3 before smtp authentication, modify the
  66. ; following three lines
  67.  
  68. pop3_server=mail.yourdomain.com
  69. pop3_username=you@yourdomain.com
  70. pop3_password=mysecretpassword
  71.  
  72. ; to force the sender to always be the following email address, uncomment and
  73. ; populate with a valid email address.  this will only affect the "MAIL FROM"
  74. ; command, it won't modify the "From: " header of the message content
  75.  
  76. force_sender=you@yourdomain.com
  77.  
  78. ; sendmail will use your hostname and your default_domain in the ehlo/helo
  79. ; smtp greeting.  you can manually set the ehlo/helo name if required
  80.  
  81. hostname=
  82.  
  83. The optional error and debug logging is recommended when trying this the first time, so you have a clue what goes wrong in case it doesn't work.
  84. Force_sender is also optional, but recommended to avoid confusion on the server end.
  85. Obviously mail.yourdomain.com, you@yourdomain.com, and mysecretpassword should be the relevant info for your SMTP server.
  86. Now restart the WAMP services (mainly Apache so PHP re-reads it's config).
  87.  
  88. Now you're good to go and use the PHP mail() statement as if you're a Unix user ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement