Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Jak ustawić smtp email dla localhosta wamp
szypi1989
post 8.09.2012, 17:04:57
Post #1





Grupa: Zarejestrowani
Postów: 207
Pomógł: 0
Dołączył: 7.09.2010

Ostrzeżenie: (0%)
-----


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.
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 2)
mrWodoo
post 8.09.2012, 17:59:06
Post #2





Grupa: Zarejestrowani
Postów: 160
Pomógł: 6
Dołączył: 13.01.2012
Skąd: Bytom

Ostrzeżenie: (0%)
-----


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. }




--------------------
Go to the top of the page
+Quote Post
szypi1989
post 9.09.2012, 09:37:02
Post #3





Grupa: Zarejestrowani
Postów: 207
Pomógł: 0
Dołączył: 7.09.2010

Ostrzeżenie: (0%)
-----


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

Ten post edytował szypi1989 9.09.2012, 11:44:12
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 14.08.2025 - 13:14