Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: Jak ustawić smtp email dla localhosta wamp
Forum PHP.pl > Forum > PHP
szypi1989
Witam Jak ustawić abym mógł z localhosta wysłać np. na ten mail temp@onet.pl. próbowałem ustawić tak smtp:
[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = smtp.poczta.onet.pl
; http://php.net/smtp-port
smtp_port = 587
; For Win32 only.
; http://php.net/sendmail-from
sendmail_from = localhost

Ale nie działa.
I nie piszcie mi że był ten temat tysiąc razy omawiany,ponieważ przejżałem google,i za każdym razem nie ma końcowej odpowiedzi.Nawet patrzałem zagraniczne strony.
mrWodoo
Serwer do mailowania u siebie postaw (np mercury) ew. jeśli np używasz konta mejlowego na zewn. serwerze to pobierz swifmailera, tutaj masz metode, jaką ja wysyłam z gmaila emaile.
  1. /**
  2. * Initialize
  3. *
  4. * @access public static
  5. */
  6. public static function initialize()
  7. {
  8. require Ceres_Application::get( 'rootDir' ) . '/Library/Swift/dependency_maps/cache_deps.php';
  9. require Ceres_Application::get( 'rootDir' ) . '/Library/Swift/dependency_maps/mime_deps.php';
  10. require Ceres_Application::get( 'rootDir' ) . '/Library/Swift/dependency_maps/message_deps.php';
  11. require Ceres_Application::get( 'rootDir' ) . '/Library/Swift/dependency_maps/transport_deps.php';
  12.  
  13. self::$_smtpTransport = Swift_SmtpTransport::newInstance( Ceres_Settings::get( 'smtp_server' ) );
  14. self::$_smtpTransport->setPort( Ceres_Settings::get( 'smtp_port' ) );
  15. self::$_smtpTransport->setUsername( Ceres_Settings::get( 'smtp_user' ) );
  16. self::$_smtpTransport->setPassword( Ceres_Settings::get( 'smtp_password' ) );
  17.  
  18. if( Ceres_Settings::get( 'smtp_ssl' ) )
  19. {
  20. self::$_smtpTransport->setEncryption( 'ssl' );
  21. }
  22.  
  23. self::$_swiftMailer = Swift_Mailer::newInstance( self::$_smtpTransport );
  24.  
  25.  
  26.  
  27. self::$_intialized = true;
  28. }
  29. /**
  30. * Send email
  31. *
  32. * @access public static
  33. * @param string $subject
  34. * @param string $msgBody
  35. * @param string $receiver
  36. * @param boolean $html Enable html in message?
  37. * @return integer
  38. */
  39. public static function send( $subject, $msgBody, $receiver, $html = true )
  40. {
  41. if( !self::$_intialized )
  42. {
  43. self::initialize();
  44. }
  45.  
  46. $message = Swift_Message::newInstance( $subject );
  47. $message->setFrom( Ceres_Settings::get( 'smtp_user' ) );
  48. $message->setTo( $receiver );
  49. $message->setBody( $msgBody );
  50. $message->setReplyTo( Ceres_Settings::get( 'smtp_user' ), Ceres_Settings::get( 'board_name' ) );
  51. $message->setContentType( 'text/' . ( ( $html ) ? 'html' : 'plain' ) );
  52.  
  53. return self::$_swiftMailer->send( $message );
  54. }


szypi1989
Gdy używam klasy swift mailer tak jak w instrukcji pisze ,i pojawia mi się błąd:
Address in mailbox given [localhost] does not comply with RFC 2822, 3.6.2

Dobra działa:)) ale nie z localhosta,ale kit z tym.działa z serwera zewnętrznego:) dzięki za klase
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.