2017-04-04 16 views
-1

私はxpertmailerを使用して、MX検索後にリモートSMTPサーバに直接メールを送信しています。これは本当にうまく動作し、PHP4と現在のPHP5ボックスを実行している古いクローズドソースのNASドライブで動作します。PHPダイレクトSMTP送信+添付

<?php 

define('DISPLAY_XPM4_ERRORS', true); // display XPM4 errors 
require_once '/path-to/SMTP.php'; // path to 'SMTP.php' file from XPM4 package 

$f = '[email protected]'; // from mail address 
$t = '[email protected]'; // to mail address 

// standard mail message RFC2822 
$m = 'From: '.$f."\r\n". 
    'To: '.$t."\r\n". 
    'Subject: test'."\r\n". 
    'Content-Type: text/plain'."\r\n\r\n". 
    'Text message.'; 

$h = explode('@', $t); // get client hostname 
$c = SMTP::MXconnect($h[1]); // connect to SMTP server (direct) from MX hosts list 
$s = SMTP::Send($c, array($t), $m, $f); // send mail 
// print result 
if ($s) echo 'Sent !'; 
else print_r($_RESULT); 
SMTP::Disconnect($c); // disconnect 

?> 

私は今それに添付ファイルを追加しようとしているが、私は含まれており、送信する添付ファイルを取得する方法をさっぱりだが。

どのようにすればいいですか?

おかげ

+0

あなたはhttp://xpertmailer.sourceforge.net/documentation/をチェックアウトしたことがありますか? "Attach"は左のリストの5番目の項目で、かなり簡単に走っています。 –

答えて

1

例:

$m = new MAIL; 

// attach source 
$a = $m->Attach('text message', 'text/plain'); 

$f = '/path/image.gif'; 
// attach file '$f', disposition 'inline' and give a name 'photo.gif' with ID value (this ID value can be used in embed HTML images) 
$a = $m->Attach(file_get_contents($f), FUNC::mime_type($f), 'photo.gif', null, null, 'inline', MIME::unique()); 

echo $a ? 'attached' : 'error'; 
+0

ありがとう..それは多くの助け:) – Rocket

関連する問題