Jump to content


Photo

Envio De Email Com Senha


  • Faça o login para participar
2 replies to this topic

#1 ozzy

ozzy

    Novato no fórum

  • Usuários
  • 10 posts
  • Sexo:Não informado

Posted 03/07/2005, 14:34

ja to a alguns dias tentando mandar emails como o smtp tem senha ta dificil autentica a senha pra manda email...
tentei o codigo abaixo q consegui neste forum, mas da erro no Mail::factory
alguem tem um codigo pronto ou sabe como o smtp reconhecer a senha?


<?

$recipients = "email@hotmail.com";

$headers["From"] = "email@hotmail.com";
$headers["To"] = "email@hotmail.com";
$headers["Subject"] = "Test message";

$body = "TEST MESSAGE!!!";

$params["host"] = "smtp.host.com.br";
$params["port"] = "25";
$params["auth"] = true;
$params["username"] = "smtp";
$params["password"] = "smtp2004";

// Create the mail object using the Mail::factory method
$mail_object =& Mail::factory("smtp", $params);

$mail_object->send($recipients, $headers, $body);
?>

#2 goiaba2000

goiaba2000

    Tô com sono!

  • Usuários
  • 1118 posts
  • Sexo:Não informado
  • Localidade:Sobradinho-DF

Posted 03/07/2005, 15:57

function aff_mail($servr, $user, $passwd, $folder, $mail, $verbose, $lang, $sort, $sortdir)
{
	$mailhost = $servr;
	require ('./conf.php');
	require ('./check_lang.php');
	GLOBAL $attach_tab;
	GLOBAL $PHP_SELF;
	$glob_body = $subject = $from = $to = $cc = $reply_to = '';

	if (setlocale (LC_TIME, $lang_locale) != $lang_locale)
  $default_date_format = $no_locale_date_format;
	$pop = @imap_open('{' . $mailhost . '}' . $folder, $user, $passwd);
	// Finding the next and previous message number
	$sorted = imap_sort($pop, $sort, $sortdir);
	$prev_msg = $next_msg = 0;
	for ($i = 0; $i < sizeof($sorted); $i++)
	{
  if ($mail == $sorted[$i])
  {
  	$prev_msg = ($i - 1 >= 0) ? $sorted[$i - 1] : 0;
  	$next_msg = ($i + 1 < sizeof($sorted)) ? $sorted[$i + 1] : 0;
  	break;
  }
	}
	// END finding the next and previous message number
	$num_messages = @imap_num_msg($pop);
	$ref_contenu_message = @imap_headerinfo($pop, $mail);
	$struct_msg = @imap_fetchstructure($pop, $mail);
	if (isset($struct_msg->parts) && (sizeof($struct_msg->parts) > 0))
  GetPart($struct_msg, NULL, $display_rfc822);
	else
  GetSinglePart($struct_msg, imap_fetchheader($pop, $mail), @imap_body($pop, $mail));
	if (($verbose == 1) && ($use_verbose == true))
  $header = imap_fetchheader($pop, $mail);
	else
  $header = '';
	$tmp = array_pop($attach_tab);
	if (eregi('text/html', $tmp['mime']) || eregi('text/plain', $tmp['mime']))
	{	
  if ($tmp['transfer'] == 'QUOTED-PRINTABLE')
  	$glob_body = imap_qprint(imap_fetchbody($pop, $mail, $tmp['number']));
  elseif ($tmp['transfer'] == 'BASE64')
  	$glob_body = base64_decode(imap_fetchbody($pop, $mail, $tmp['number']));
  else
  	$glob_body = imap_fetchbody($pop, $mail, $tmp['number']);
  $glob_body = remove_stuff($glob_body, $lang, $tmp['mime']);
	}
	else
  array_push($attach_tab, $tmp);
	@imap_close($pop);
	if ($struct_msg->subtype != 'ALTERNATIVE' && $struct_msg->subtype != 'RELATED')
	{
  switch (sizeof($attach_tab))
  {
  	case 0:
    $link_att = '';
    break;
  	case 1:
    $link_att = '<tr><td align="right" valign="top" class="mail">' . $html_att . '</td><td bgcolor="' . $glob_theme->mail_properties . '" class="mail">' . link_att($mailhost, $mail, $attach_tab, $display_part_no) . '</td></tr>';
    break;
  	default:
    $link_att = '<tr><td align="right" valign="top" class="mail">' . $html_atts . '</td><td bgcolor="' . $glob_theme->mail_properties . '" class="mail">' . link_att($mailhost, $mail, $attach_tab, $display_part_no) . '</td></tr>';
    break;
  }
	}
	$subject_array = imap_mime_header_decode($ref_contenu_message->subject);
	for ($j = 0; $j < count($subject_array); $j++)
  $subject .= $subject_array[$j]->text;
	$from_array = imap_mime_header_decode($ref_contenu_message->fromaddress);
	for ($j = 0; $j < count($from_array); $j++)
  $from .= $from_array[$j]->text;
	$to_array = imap_mime_header_decode($ref_contenu_message->toaddress);
	for ($j = 0; $j < count($to_array); $j++)
  $to .= $to_array[$j]->text;
	$to = str_replace(',', ', ', $to);
	$cc_array = isset($ref_contenu_message->ccaddress) ? imap_mime_header_decode($ref_contenu_message->ccaddress) : 0;
	for ($j = 0; $j < count($cc_array); $j++)
  $cc .= $cc_array[$j]->text;
	$cc = str_replace(',', ', ', $cc);
	$reply_to_array = isset($ref_contenu_message->reply_toaddress) ? imap_mime_header_decode($ref_contenu_message->reply_toaddress) : 0;
	for ($j = 0; $j < count($reply_to_array); $j++)
  $reply_to .= $reply_to_array[$j]->text;
	list($date, $complete_date) = change_date(chop($ref_contenu_message->udate), $lang);
	$content = Array(
  'from' => $from,
  'to' => $to,
  'cc' => $cc,
  'reply_to' => $reply_to,
  'subject' => $subject,
  'date' => $date,
  'complete_date' => $complete_date,
  'att' => $link_att,
  'body' => $glob_body,
  'body_mime' => $tmp['mime'],
  'body_transfer' => $tmp['transfer'],
  'header' => $header,
  'verbose' => $verbose,
  'prev' => $prev_msg,
  'next' => $next_msg
	);
	return ($content);
}

-----x-------------------------------------------------

esqueci de falar... isso é pra imap


Edite o último post ao invés de criar outro seguidamente.

Edição feita por: Justice, 03/07/2005, 18:27.

PHP + UML + OO + Flash + MySQL = IMBATIVEL

http://www.guilardi.com.br
- portifólio
http://www.deusehmais.com.br
- projeto atual

#3 ozzy

ozzy

    Novato no fórum

  • Usuários
  • 10 posts
  • Sexo:Não informado

Posted 03/07/2005, 17:57

vixi n tem pra php?
isso ae passo vuando




1 user(s) are reading this topic

0 membro(s), 1 visitante(s) e 0 membros anônimo(s)

IPB Skin By Virteq