| Autor | Zpráva | ||
|---|---|---|---|
| servertom Profil |
#1 · Zasláno: 19. 8. 2010, 14:34:00 · Upravil/a: servertom
Ahoj prosím o pomoc,jedná se o Coppermine galerii.Potřebuji aby se my s tímto formulářem zasílala samotná fotka v příloze.Zkoušel jsem ruzný možnosti jak $mail->AddAttachment vložit ale vždy se mi to odešle bez přílohy.Děkuji za pomoc
Soubor ecard: require('include/mailer.inc.php');
if ($CONFIG['make_intermediate'] && max($row['pwidth'], $row['pheight']) > $CONFIG['picture_width']) {
$n_picname = get_pic_url($row, 'normal');
} else {
$n_picname = get_pic_url($row, 'fullsize');
}
if (!stristr($n_picname, 'http:')) {
$n_picname = $gallery_url_prefix . $n_picname;
}
$msg_content = process_smilies($message, $gallery_url_prefix);
$data = array(
'rn' => $superCage->post->noTags('recipient_name'),
'sn' => $superCage->post->noTags('sender_name'),
'se' => $sender_email,
'p' => $n_picname,
'g' => $greetings,
'm' => $message,
'pid' => $pid,
'pt' => $pic_title,
'pc' => $pic_caption,
);
$encoded_data = urlencode(base64_encode(serialize($data)));
$params = array(
'{LANG_DIR}' => $lang_text_dir,
'{TITLE}' => sprintf($lang_ecard_php['ecard_title'], $sender_name),
'{CHARSET}' => $CONFIG['charset'] == 'language file' ? $lang_charset : $CONFIG['charset'],
'{VIEW_ECARD_TGT}' => "{$gallery_url_prefix}displayecard.php?data=$encoded_data",
'{VIEW_ECARD_LNK}' => $lang_ecard_php['view_ecard'],
'{VIEW_ECARD_LNK_PLAINTEXT}' => $lang_ecard_php['view_ecard_plaintext'],
'{PIC_URL}' => $n_picname,
'{URL_PREFIX}' => $gallery_url_prefix,
'{GREETINGS}' => $greetings,
'{MESSAGE}' => bb_decode($msg_content),
'{PLAINTEXT_MESSAGE}' => $message,
'{SENDER_EMAIL}' => $sender_email,
'{SENDER_NAME}' => $sender_name,
'{VIEW_MORE_TGT}' => $CONFIG['ecards_more_pic_target'],
'{VIEW_MORE_LNK}' => $lang_ecard_php['view_more_pics'],
'{PID}' => $pid,
'{PIC_TITLE}' => $pic_title,
'{PIC_CAPTION}' => $pic_caption,
'{PIC_MARKUP}' => $pic_markup,
);
$message = template_eval($template_ecard, $params);
$plaintext_message = template_eval($template_ecard_plaintext, $params);
$tempTime = time();
$message .= sprintf($lang_ecard_php['ecards_footer'], $sender_name, $raw_ip, localised_date(-1, $lang_date['comment']));
$subject = $pic_title;
$AddAttachment = $pic_markup;//ode mě
$result = cpg_mail($recipient_email, $subject, $AddAttachment, $message, 'text/html', $sender_name, $sender_email, $plaintext_message);
if (!USER_ID) {
$USER['name'] = $sender_name;
$USER['email'] = $sender_email; }
if ($result) {mailer.inc.php // Custom mail function
function cpg_mail($to, $subject, $AddAttachment, $msg_body = '', $type = 'text/plain', $sender_name = '', $sender_email = '', $msg_body_plaintext = '')
{
global $CONFIG, $lang_charset, $HTML_SUBST;
// makeshift plaintext if not set
if (!$msg_body_plaintext){
$msg_body_plaintext = strip_tags($msg_body);
}
// send mails to ALL admins - not bridged only
if ($to == 'admin') {
if (UDB_INTEGRATION == 'coppermine') {
$to = array($CONFIG['gallery_admin_email']);
$result = cpg_db_query("SELECT user_email FROM {$CONFIG['TABLE_USERS']} WHERE user_group = 1");
while ($row = mysql_fetch_assoc($result)) {
if (!empty($row['user_email'])) {
$to[] = $row['user_email'];
}
}
$to = array_unique($to);
} else {
$to = array($CONFIG['gallery_admin_email']);
}
} else {
$to = array($to);
}
$to = CPGPluginAPI::filter('cpg_mail_to_email', $to);
if ($sender_name == '') {
$sender_name = $CONFIG['gallery_name'];
}
if ($sender_email == '') {
$sender_email = $CONFIG['gallery_admin_email'];
}
$sender_email = CPGPluginAPI::filter('cpg_mail_sender_email', $sender_email);
$sender_name = strtr($sender_name, array_flip($HTML_SUBST));
$charset = $CONFIG['charset'] == 'language file' ? $lang_charset : $CONFIG['charset'];
$mail = new cpg_PHPmailer();
if ($CONFIG['smtp_host']) {
$mail->IsSMTP();
$mail->Host = $CONFIG['smtp_host'];
if ($CONFIG['smtp_username']) {
$mail->SMTPAuth = true;
$mail->Username = $CONFIG['smtp_username'];
$mail->Password = $CONFIG['smtp_password'];
} else {
$mail->SMTPAuth = false;
}
} else {
$mail->IsMail();
}
$mail->IsHTML(true);
foreach ($to as $email) {
$mail->AddAddress($email);
}
$mail->From = $sender_email;
$mail->FromName = $sender_name;
$mail->Subject = $subject;
$mail->Body = $msg_body;
$mail->AltBody = $msg_body_plaintext;
$mail->CharSet = $charset;
$mail->AddAttachment($AddAttachment);
if ($CONFIG['smtp_host'] && $CONFIG['log_mode'] == CPG_LOG_ALL) {
$mail->SMTPDebug = 2;
ob_start();
}
$result = $mail->Send();
if ($CONFIG['smtp_host'] && $CONFIG['log_mode'] == CPG_LOG_ALL) {
$log = ob_get_clean();
log_write($log, CPG_MAIL_LOG);
}
return $result;
}
DÁL POKRAČUJE KLASICKÝ
class.phpmailer.php |
||
| nightfish Profil |
#2 · Zasláno: 19. 8. 2010, 14:39:15 · Upravil/a: nightfish
servertom:
Zkusil jsi vložil tolik zbytečného kódu, že jej server raději oříznul. Vlož sem jen relevantní část, kde se pracuje v PHPmailerem. Případně použij nějakou vhodnout službu (pastebin.com) pro vložení kódu celého, ale ber na vědomí, že čím bude delší, tím míň lidí se v něm bude chtít vrtat. |
||
| servertom Profil |
#3 · Zasláno: 19. 8. 2010, 14:43:12 · Upravil/a: servertom
Omlouvám se hned to napravím
|
||
| nightfish Profil |
#4 · Zasláno: 19. 8. 2010, 14:45:06 · Upravil/a: nightfish
servertom:
Používáš funkci cpg_mail (ta s PHPMailerem nemá nic společného) - kontaktuj toho, kdo tu funkci napsal. Jinak to asi nepůjde. |
||
| servertom Profil |
#5 · Zasláno: 19. 8. 2010, 15:06:51
nightfish:
funguje, ta funkce má pokračování mailer.inc.php -řádek 36.Jen k tomu potřebuji dostat tu přílohu. |
||
| servertom Profil |
#6 · Zasláno: 19. 8. 2010, 15:09:51 · Upravil/a: servertom
Celej soubor ecard zde: pastebin.com
Vyřešeno |
||
|
Časová prodleva: 15 let
|
|||
0