検索条件
全4件
(1/1ページ)
$body = '<html><body bgcolor="#aabbff">
<h1>HTMLメールテスト</h1>
<b>太字</b>
<font color="red">文字色を変えてみます。</font>
<div>画像はこのように</div>
<img src="cid:test1.jpg">
<div>文章中に置くことができます。</div>
<img src="cid:test2.jpg">
<p>Send by Qdmail</p>
<div>携帯端末、キャリアによって使えるHTMLタグが違いますので注意してください。</div>
<div><a href="mailto:address@example.com">メールはこちらへ</a></div>
<div><a href="tel:00-0000-0000">電話はこちらへ</a></div>
</body></html>';
qd_send_mail(
'deco',
array('address@exaple.com' , '宛先(日本語OK)' ) ,
'デコメのテスト' ,
$body,
array ( 'from@example.com' , '配信元(日本語OK)'),
array(array('test1.jpg'),array(test2.jpg))
);
qd_send_mail( 'text', 宛先, 件名, 本文, From情報(&追加ヘッダー), 添付ファイル指定 );
$to = array( 'address@example.com' , '宛先日本語名' ); $from = array( 'from@example.com' , '送り元日本語名' ); $subject = 'メールのテスト(テキスト)'; $body = "ここに本文を書きます。"; qd_send_mail( 'text' , $to , $subject , $body , $from);
$to = 'address@example.com' ; $from = 'from@example.com' ; (以下、省略)
$to = array( 'address@example.com' , '宛先日本語名' ); $from = array( 'from@example.com' , '送り元日本語名' ); $subject = 'メールのテスト(テキスト)'; $body = "ここに本文を書きます。"; $attach = array( 'test.jpg' , '添付フィル.jpg'); qd_send_mail( 'text' , $to , $subject , $body , $from , $attach);添付ファイルのファイル名は、相対指定です。
$attach = array( 'test.jpg'); (他省略)
$attach = array( 'test.jpg' , '添付フィル.jpg' , 'test/mime' ); (他省略)これで
--__Next-1-......__ Content-Type: test/mime; name="=?iso-2022-jp?B?GyRCRTpJVSVVJSMlaxsoQi5qcGc=?="というヘッダになります。
$attach1 = array( 'test.jpg' , '添付1' ); $attach2 = array( 'test2.jpg' , '添付2' ); $attach = array($attach1,$attach2); (他省略) qd_send_mail( 'text' , $to , $subject , $body , $from , $attach);
$add_header = array(
'From' => array('from@example.com','FROM表示名'),
'header-name' => 'parameter',
);
(他省略)
qd_send_mail( 'text' , $to , $subject , $body , $add_header , $attach);
(FROM表示名が必要なく、メールアドレスだけでいい場合は'From'=>'from@example.com'でも構いません。
$from = array( 'From' => array('from@example.com','FROM表示名' ));
$add_header1 = array( 'header-name' => 'parameter' );
$add_header2 = array( 'header-name2' => 'parameter2' );
$add_header = array( $from , $add_header1 , $add_header2 );
(他省略)
qd_send_mail( 'text' , $to , $subject , $body , $add_header , $attach);
qd_send_mail( 'メールタイプ' ,
'address@example.com',
'件名',
'本文',
'from@example.com'
);
$to = array('address@example.com','宛先日本語');
$from = array('from@example.com','フロム日本語');
qd_send_mail( 'text' , $to , '題名ですsubject' , '本文' , $from );
$to = array('address@example.com','宛先日本語');
$from = array('from@example.com','フロム日本語');
$attach = array('test.jpg','添付ファイル日本語名');
qd_send_mail( 'text' , $to , '題名ですsubject' , '本文' , $from , $attach);
$to = array('address@example.com','宛先日本語');
$from = array('from@example.com','フロム日本語');
$attach1 = array('test1.jpg','添付ファイル日本語名');
$attach2 = array('test2.jpg','添付ファイル日本語名');
$attach = array($attach1,$attach2);
qd_send_mail( 'text' , $to , '題名ですsubject' , '本文' , $from , $attach);
$to = array('address@example.com','宛先日本語');
$from = array('from@example.com','フロム日本語');
$attach = array('test.jpg','添付ファイル日本語名',true,'image/jpeg');
qd_send_mail( 'text' , $to , '題名ですsubject' , '本文' , $from , $attach);
(※ ここではあくまでもQdSmtpオブジェクト(インスタンス)を明示的に扱いたい場合であって、簡単にsmtp送信するだけならQdSmtpでのSMTP送信の方法の方が簡単かと思います。)
- Qdmailが内部生成したQdSmtpインスタンスをユーザーに渡す。
- QdSmtpインスタンスをユーザー側でnewし、それをQdmailに渡す。
$param = array(
'host'=>'smtp.example.com',
'pop_host'=>'pop.example.com',
'port'=> 25 ,
'from'=>'from@example.com',
'protocol'=>'POP_BEFORE',
'pop_user'=>'pop_user_id',
'pop_pass' => 'pop_password',
);
$mail -> smtp(true);
$mail -> smtpServer($param);
$smtp=& $mail->smtpObject(); // QdSmtpのオブジェクトを取得
$smtp -> pop3TimeFilename( 'henkou_filename.txt' ); // POP制御のためのファイル名変更
$smtp -> pop3ValidMinute( 5 ); // POP間隔の変更
$message=$itsme.$sender_mess."ここに本文を書きます。";
$flag=$mail ->easyText('address@example.com','宛先','タイトル',$message,'from@example.com');
(PHP5の場合は、& は必要ありません。)$smtp=& $mail->smtpObject(); // QdSmtpのオブジェクトを取得 $smtp -> pop3TimeFilename( 'henkou_filename.txt' ); // POP制御のためのファイル名変更 $smtp -> pop3ValidMinute( 5 ); // POP間隔の変更の部分が、QdSmtpを操作している部分ですが、PHP5の場合は、わざわざ、$smtpという変数にいったん代入しなくても、以下のようにすることもできます。
$smtp -> $mail->smtpObject() -> pop3TimeFilename( 'henkou_filename.txt' ); $smtp -> $mail->smtpObject() -> pop3ValidMinute( 5 );続いて、2の方法を説明します。
require_once('qdmail.php');
$message='<font color="red">メールの中身を書きます。</font>';
$mail ->to('address@example.com');
$mail ->subject('メールのテスト');
$mail ->from('from@example.com');
$mail ->html($message);
//ここまでは通常のQdmailの操作
//ここからQdSmtpの操作
require_once('qdsmtp.php');
$smtp = & new qdsmtp;
$param = array(
'host'=>'smtp.example.com',
'pop_host'=>'pop.example.com',
'port'=> 25 ,
'from'=>'from@example.com',
'protocol'=>'POP_BEFORE',
'pop_user'=>'pop_user_id',
'pop_pass' => 'pop_password',
);
$smtp -> server($param);
$smtp -> pop3TimeFilename( 'henkou_pop_file.txt' );
$smtp -> pop3ValidMinute( 5 );
$mail->setSmtpObject($smtp);//QdmailにQdSmtpのインスタンスを渡す
$flag=$mail ->send();
なお、$mail->setSmtpObject($smtp);//QdmailにQdSmtpのインスタンスを渡す $flag=$mail ->send();の部分は、PHP5であれば、以下のように書くこともできます。
$flag=$mail -> send($smtp);このsend($smtp)式は、PHP4でも送信できますが、$smtpインスタンスがディープコピー(clone copy)されるので、若干メモリの無駄使いとなります。