Yii SMTP

yii framework มี extension การส่งเมลอยู่ที่

protected/extensions/yii-mail

โดยเราจะต้องเขียนเพิ่มที่


protected/config/main.php

    'mail' => array(
      'class' => 'ext.yii-mail.YiiMail',
      'transportType' => 'smtp',
      'transportOptions'=>array(
                'host'=>'smtp.live.com',
                'username'=>'username',
                'password'=>'password',
                'port'=>'587',
                'encryption'=>'tls',
                ),
      'viewPath' => 'application.views.mail',
      'logging' => true,
      'dryRun' => false
    ),

แต่…
แต่ทว่า…

เราจะส่งเมลไม่ไปครับ

Error 500
fsockopen(): SSL operation failed with code 1. OpenSSL Error messages: error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number

เพราะว่า Swiftmailer ของ yii มันเก่ามากครับ

http://code.google.com/p/yii-mail/issues/detail?id=15

เราจึงต้อง Upgrade มันโดยการ download

http://swiftmailer.org/download

เอาไปทับของเก่าได้เลยครับ

drupal 6 smtp module

โหลด module มาจาก

http://drupal.org/project/smtp

enable module

drupal6-SMTP-authentication

ใส่ค่า smtp

drupal6 smtp module

drupal6 smtp module

โหลด PHPmailer

https://code.google.com/a/apache-extras.org/p/phpmailer/downloads/list

แตกไฟล์เสร็จแล้ว เปลี่ยนชื่อ directory เป็น phpmailer เอาไปวางไว้ที่
sites/all/modules/
sites/all/libraries/

ถ้าเจอ error

drupal6-SMTP-error

ให้ติดตั้ง phpmailer

# aptitude install libphp-phpmailer

skype over precise

$ sudo aptitude install skype
The following NEW packages will be installed:
gcc-4.6-base:i386{a} libasound2:i386{a} libasound2-plugins:i386{a}
libasyncns0:i386{a} libaudio2:i386{a} libavahi-client3:i386{a}
libavahi-common-data:i386{a} libavahi-common3:i386{a} libc6:i386{a}
libcomerr2:i386{a} libcups2:i386{a} libdbus-1-3:i386{a} libdbusmenu-qt2:i386{a}
libexpat1:i386{a} libffi6:i386{a} libflac8:i386{a} libfontconfig1:i386{a}
libfreetype6:i386{a} libgcc1:i386{a} libgcrypt11:i386{a} libglib2.0-0:i386{a}
libgnutls26:i386{a} libgpg-error0:i386{a} libgssapi-krb5-2:i386{a}
libgstreamer-plugins-base0.10-0:i386{a} libgstreamer0.10-0:i386{a} libice6:i386{a}
libjack-jackd2-0:i386{a} libjpeg-turbo8:i386{a} libjpeg8:i386{a} libjson0:i386{a}
libk5crypto3:i386{a} libkeyutils1:i386{a} libkrb5-3:i386{a}
libkrb5support0:i386{a} liblcms1:i386{a} libmng1:i386{a} libmysqlclient18:i386{a}
libogg0:i386{a} liborc-0.4-0:i386{a} libp11-kit0:i386{a} libpcre3:i386{a}
libpng12-0:i386{a} libpulse0:i386{a} libqt4-dbus:i386{a}
libqt4-declarative:i386{a} libqt4-network:i386{a} libqt4-script:i386{a}
libqt4-sql:i386{a} libqt4-sql-mysql:i386{a} libqt4-xml:i386{a}
libqt4-xmlpatterns:i386{a} libqtcore4:i386{a} libqtgui4:i386{a}
libqtwebkit4:i386{a} libsamplerate0:i386{a} libselinux1:i386{a} libsm6:i386{a}
libsndfile1:i386{a} libspeexdsp1:i386{a} libsqlite3-0:i386{a} libssl1.0.0:i386{a}
libstdc++6:i386{a} libtasn1-3:i386{a} libtiff4:i386{a} libuuid1:i386{a}
libvorbis0a:i386{a} libvorbisenc2:i386{a} libwrap0:i386{a} libx11-6:i386{a}
libxau6:i386{a} libxcb1:i386{a} libxdmcp6:i386{a} libxext6:i386{a} libxi6:i386{a}
libxml2:i386{a} libxrender1:i386{a} libxss1:i386{a} libxt6:i386{a} libxv1:i386{a}
qt-at-spi:i386{a} skype skype-bin:i386{a} sni-qt:i386{a} zlib1g:i386{a}
0 packages upgraded, 85 newly installed, 0 to remove and 0 not upgraded.
Need to get 65.7 MB of archives. After unpacking 152 MB will be used.
Do you want to continue? [Y/n/?]

EnvironmentError: mysql_config not found

problem

# pip install MySQL-python==1.2.3
Downloading/unpacking MySQL-python==1.2.3
  Downloading MySQL-python-1.2.3.tar.gz (70Kb): 70Kb downloaded
  Running setup.py egg_info for package MySQL-python
    sh: mysql_config: not found
    Traceback (most recent call last):
      File "<string>", line 14, in <module>
      File "/root/build/MySQL-python/setup.py", line 15, in <module>
        metadata, options = get_config()
      File "setup_posix.py", line 43, in get_config
        libs = mysql_config("libs_r")
      File "setup_posix.py", line 24, in mysql_config
        raise EnvironmentError("%s not found" % (mysql_config.path,))
    EnvironmentError: mysql_config not found
    Complete output from command python setup.py egg_info:
    sh: mysql_config: not found

Traceback (most recent call last):

  File "<string>", line 14, in <module>

  File "/root/build/MySQL-python/setup.py", line 15, in <module>

    metadata, options = get_config()

  File "setup_posix.py", line 43, in get_config

    libs = mysql_config("libs_r")

  File "setup_posix.py", line 24, in mysql_config

    raise EnvironmentError("%s not found" % (mysql_config.path,))

EnvironmentError: mysql_config not found

----------------------------------------
Command python setup.py egg_info failed with error code 1 in /root/build/MySQL-python
Storing complete log in /root/.pip/pip.log

solved

# aptitude install libmysqlclient-dev